Skip to main content
Announcements
Introducing Qlik Answers: A plug-and-play, Generative AI powered RAG solution. READ ALL ABOUT IT!
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

MOVING AVERAGE ???

Dear all,

I have calculated the 06 month moving average by using following expression starting from Jan'2013.

RANGEAVG(ABOVE(RANGESUM(PREMIUM),0,6))

But the results are not in order since Jan'2014 , may be due to year change. Please any one can help me urgently.

Results of the same table is as follows.

       

BCODSTATUSME_CODEYEARMONTHPREMIUMMOV_AVG
B100EX -32,790-32,790
B1001DIR D2013Jan49,81949,819
B1001DIR D2013Feb43,48146,650
B1001DIR D2013Mar43,16045,487
B1001DIR D2013Apr61,72049,545
B1001DIR D2013May92,93958,224
B1001DIR D2013Jun39,87355,166
B1001DIR D2013Jul79,64560,136
B1001DIR D2013Aug77,56665,817
B1001DIR D2013Sep52,51667,377
B1001DIR D2013Oct172,02685,761
B1001DIR D2013Nov54,61079,373
B1001DIR D2013Dec89,75287,686
B1001DIR D2014Jan104,598104,598
B1001DIR D2014Feb114,533109,566
B1001DIR D2014Mar137,232118,788
B1001DIR D2014Apr105,700115,516
B1001DIR D2014May84,865

109,386

Priyantha.

4 Replies
Gysbert_Wassenaar

Yes, when you want to cross dimension borders you need to add the TOTAL keyword


RANGEAVG(ABOVE(TOTAL RANGESUM(PREMIUM),0,6))


talk is cheap, supply exceeds demand
Not applicable
Author

Dear Gysbert,

by adding total keyword whole dimension borders are crossing. Just i want to cross only the Year border

Priyantha.

Gysbert_Wassenaar

That's not possible. You'll have to use another approach. See this document: Calculating rolling n-period totals, averages or other aggregations


talk is cheap, supply exceeds demand
Not applicable
Author

Thanks........Gybert,