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: 
ksharpes
Creator
Creator

Range Average - do not show results without full range of data

I have the below expression showing a moving average over 12 months of sales, if i only want to show data where it has a full 12 months to calculate the average how can i do this?

 

rangeavg(above(Sum({<[Reporting Date]={">=$(=AddMonths(Max([Reporting Date]),-24))"}>} [Sales Qty (All)]),0,12)) ,

1 Solution

Accepted Solutions
sunny_talwar

May be this?

If(RowNo(TOTAL) >= 12, 
RangeAvg(Above(Sum({<[Reporting Date] = {">=$(=AddMonths(Max([Reporting Date]),-24))"}>} [Sales Qty (All)]), 0, 12))
)

 

View solution in original post

8 Replies
zied_ahmed1
Specialist
Specialist

Hello,

Can you please send us data to test 

 

Thanks 

ksharpes
Creator
Creator
Author

Essentially I want the below with the Moving average only calculating if it has 12 data points.

 

[Reporting Date][Sales Qty (All)]Moving Average
110 
212 
313 
414 
511 
610 
712 
813 
914 
1011 
1110 
121211.83333333
131312.08333333
141112
151312
161412
171512.33333333
181212.5
191112.41666667
201312.41666667
211412.41666667
221512.75
231212.91666667
241112.83333333

 

zied_ahmed1
Specialist
Specialist

Thanks,Can you please give us an example of the result to have 🙂 

ksharpes
Creator
Creator
Author

clipboard_image_0.png

ksharpes
Creator
Creator
Author

Any luck on this, I was thinking something along the lines of If statement where a count of the "above" results is equal to or more than 12, is that possible?

sunny_talwar

May be this?

If(RowNo(TOTAL) >= 12, 
RangeAvg(Above(Sum({<[Reporting Date] = {">=$(=AddMonths(Max([Reporting Date]),-24))"}>} [Sales Qty (All)]), 0, 12))
)

 

ksharpes
Creator
Creator
Author

Perfect!

Channa
Specialist III
Specialist III

Instead of rowno() put 12
Channa