Do not input private or sensitive data. View Qlik Privacy & Cookie Policy.
Skip to main content

Announcements
Join us to spark ideas for how to put the latest capabilities into action. Register here!
cancel
Showing results for 
Search instead for 
Did you mean: 
Anonymous69
Contributor II
Contributor II

Running AVG on PIVOT

Hi ,

 

I have this formula below, which is a half-baked cake as it is. It's supposed to calculate the moving average for every five days for every data point, in other words, the average of the previous five days' sales.

The pivot is sorted by salesdate in descending order, so the calculation below starts the average calculation from the latest date instead of the earliest date. Please help!
 

 

 

AGGR(
RangeAvg(
Above(
Sum(Sales), 0, 5
)
),
Client, (SalesDate.autoCalendar.Date, DESC)
)

2 Replies
Anonymous69
Contributor II
Contributor II
Author

CLient is the row header while date and order ID are columns. Thanks in advance

Anonymous69
Contributor II
Contributor II
Author

Please feel free to provide a completely different measure or advice that works. Also, do let me know if this is impossible in Qlik