Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
I have incident data stored like the below and I need to calculate the average number of tickets created by hour each day. I know I need to use AGGR() but I just can't quite get it right.
Ticket | Date | Hour |
---|---|---|
Ticket1 | 3/4/2016 | 1 |
Ticket2 | 3/5/2016 | 1 |
Ticket3 | 3/5/2016 | 1 |
Ticket4 | 3/6/2016 | 1 |
Ticket5 | 3/6/2016 | 1 |
Ticket6 | 3/6/2016 | 1 |
Ticket7 | 3/6/2016 | 1 |
Ticket8 | 3/6/2016 | 1 |
Ticket9 | 3/6/2016 | 1 |
Ticket1 | 3/4/2016 | 2 |
Ticket2 | 3/5/2016 | 2 |
Ticket3 | 3/5/2016 | 2 |
Ticket4 | 3/6/2016 | 2 |
Ticket5 | 3/6/2016 | 2 |
Ticket6 | 3/6/2016 | 2 |
Ticket7 | 3/6/2016 | 2 |
Ticket8 | 3/6/2016 | 2 |
Ticket9 | 3/6/2016 | 2 |
In the end I want to see:
Hour | Average |
---|---|
1 | 3 |
2 | 3 |
You can use:
Avg(Aggr(Count(Ticket),Date,Hour))
avg(aggr(Count(distinct Ticket), Hour, Date))
So I didn't even think to just throw Date, Hour together into the Aggr() function. You both responded almost identically but Maxgro listed Hour first. Does order matter?
no
In some circumstances it might matter (unless you have QV12, where we have work around available), but for this particular scenario it won't.