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

Announcements
Join us in Toronto Sept 9th for Qlik's AI Reality Tour! Register Now
cancel
Showing results for 
Search instead for 
Did you mean: 
tracycrown
Creator III
Creator III

Moving Average not working

Dear all

Kindly advise why 4 quarters moving average MA(4) is not working after adding year and quarter in the dimension ?.

The correct answer should be as follows: 

tYearQuarterSalesMA(4)
120141         4.8 
220142         4.1 
320143         6.05.4
420144         6.55.6
520151         5.85.9
620152         5.26.1
720153         6.86.3
820154         7.46.4
920161         6.06.5
1020162         5.66.6
1120163         7.56.7
1220164         7.86.8
1320171         6.36.9
1420172         5.97.0
1520173         8.07.2
1620174         8.4 

 

Thank you

Tracy

Labels (1)
1 Solution

Accepted Solutions
sunny_talwar

Try this

Aggr(RangeAvg(Above(Sum(Sales), 0, 4)), t)

View solution in original post

3 Replies
sunny_talwar

Try this

Aggr(RangeAvg(Above(Sum(Sales), 0, 4)), t)
tracycrown
Creator III
Creator III
Author

Dear Sunny

The answer is correct but how to make first two (t1 & t2) and last (t16) records of MA(4) equal blank ?.

Thank you

Tracy

sunny_talwar

Try this

Aggr(If(RowNo() > 2 and RowNo() <> NoOfRows(), RangeAvg(Above(Sum(Sales), 0, 4))), t)