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

Announcements
Qlik Connect 2026! Turn data into bold moves, April 13 -15: Learn More!
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

Recurring aggregation

Hi,

Has anyone tried to do an aggregation like this:

Fields: Sales, YearMonth

Create a straight table with:

dimension: YearMonth

expression: The total average of last 12 months (for YearMonth on same row)

As output I expect to get, for example, the row corresponding to dimension March-2009 the expression would be the sum of Sales from April-2008 through March-2009, divided by 12

Is it possible at all?

Thanks.

4 Replies
Not applicable
Author

Maybe a rangeavg(Value, peek(Value), peek(Value,-2)...)? (table must be sorted by YearMonth when calculating)

Not applicable
Author

Thanks for the response. Isn't peek a script only function? I'm trying to do this with formulas and set analysis. With a relational DBMS is trivial but within qlikview dimensional model is quite hard, at least for me and some of my colleagues. But it would be rather useful to get it working outside the data sources.

msteedle
Partner - Creator
Partner - Creator

There's an expression called RangeAvg() you will want to check out. For your example, with a straight table with a dimension of YearMonth and a measure of Sales, this would be the expression for rolling 12-month averages: RangeAvg(Above(Sum(Sales),0,12))

Not applicable
Author

That's it! Thanks much.