Quantcast
Channel: SCN : Unanswered Discussions - Data Services and Data Quality
Viewing all articles
Browse latest Browse all 3719

Aggregating Latest Month Data

$
0
0

Hi Experts,

 

I'm reporting on ticketing data. A ticket, can have multiple tasks linked to it, which provides the details hours worked by resource, and the worked date.

 

I'm trying to aggregate my records to only have the most recently worked task, and aggregate only the hours worked for that latest current month.

 

Example:

 

Ticket      Task       Date Worked         Hours

    1             1             1.5.2015                 2

    1             2             4.13.2015               5

    1             3             6.28.2015               3

    1             4             6.14.2015               4

 

In my final template table, since the latest month worked was June (6), and there were two tasks that generated hours in June, I want the date worked to be the most recent date (6.28.2015) and the hours worked to be the aggregate of all hours worked in June (the sum of tasks 3 and 4)

 

Ticket      Date Worked         Hours

   1               6.28.2015              7


I've figured out how to get the most recent record, by:

1. Query transform that sorts descending by Ticket, Date Worked

2. Query transform that creates a sequence number by Ticket

3. Query transform that has a where clause to only fetch sequence number 1


My trouble is how to identify all the tasks by ticket that occurred in the same month as the most recent date worked for that ticket, and then aggregate them.


I appreciate your feedback.


Best regards,


Marcelo


Viewing all articles
Browse latest Browse all 3719

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>