Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 
ramkrishna86
Creator II
Creator II

Sum of Rolling 3 month(YYYYMMDD) data

Hi,

Anyone can help me to calculate sum of rolling 3-month(Current month and previous 2 month)  data in qlik sense.

Thanks,

Ram Krishna

5 Replies
Gysbert_Wassenaar

See this document: Calculating rolling n-period totals, averages or other aggregations


talk is cheap, supply exceeds demand
jagan
Luminary Alumni
Luminary Alumni

Hi,

Try like this

Sum({<Year=, Quarter=, Month=, Week=, Date={‘>=$(=MonthStart(Max(Date), -2))<=$(=Date(Max(Date)))’}>} Sales )

Check below link for similar type of expressions for various scenarios.

Set Analysis for Rolling Periods

Regards,

jagan.

ramkrishna86
Creator II
Creator II
Author

How to do in load script?

jagan
Luminary Alumni
Luminary Alumni

Hi,

Try like this,

LOAD

*,

If(DateFieldName >= MonthStart(Today(), -2), 1, 0) AS Flag

FROM DataSource;

Now in set analysis try like this using flag

=Sum({<Flag={1}>} Sales)

Hope this helps you.

Regards,

Jagan.

ramkrishna86
Creator II
Creator II
Author

Hey, Do you have any QVW or QVX file that are using rolling sum, it will be great help if you can attach the same.