Skip to main content
Announcements
Join us at Qlik Connect for 3 magical days of learning, networking,and inspiration! REGISTER TODAY and save!
cancel
Showing results for 
Search instead for 
Did you mean: 
yogendra_wasaik
Contributor
Contributor

I want to show average of rolling 6 months excluding previous 3 months from current date.

Eg.

If current date is 29th april 2021 excluding 3months it will be 29 th jan 2021.

So again backward 6 month -29th jan 2021 to 29 june 2020 avg of sale will display for 29th april 2021 same for onwards.

 

3 Replies
rubenmarin

Hi, this could something like: Sum({<DateField={">=$(=AddMonths(Today(),-9))<=$(=AddMonths(Today(),-3))"}>} ValueToSum)

yogendra_wasaik
Contributor
Contributor
Author

Thank you for the solution.

My requirement is, 

29 june 2020 to 29th Jan 2021 avg sale should be shown for 29th april 2021 in straight table.

How I can show it?

 

rubenmarin

Hi, daily avg? you can use an aggr that splits each value and then do the average of those values. So daily can be:

Avg({<DateField={">=$(=AddMonths(Today(),-9))<=$(=AddMonths(Today(),-3))"} Aggr(Sum({<DateField={">=$(=AddMonths(Today(),-9))<=$(=AddMonths(Today(),-3))"}>} ValueToSum), DateField))

The dimensions of the table can also affect the final needed solution, maybe you need to add TOTAL clause to ignore some dimensions.