Skip to main content
Announcements
Qlik Connect 2025: 3 days of full immersion in data, analytics, and AI. May 13-15 | Orlando, FL: Learn More
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

Rolling 2 months Data

Hi,

I need to calculate amount for last two months.

I have month and amount field. I need to calculate the amount for last two months, like I need to calculate amount for march and april. How to do this in the expression of a chart?

4 Replies
johnw
Champion III
Champion III

It may be as simple as going to the Expressions tab, selecting Accumulate for that expression, and entering 2 for Steps Back.

Anonymous
Not applicable
Author

It may look like this, assuming that in May you want to see March and April:
sum(if(Date>=monthstart(addmonths(today(), -2)) and Date <=monthend(addmonths(today(), -1)), Amount))

Anonymous
Not applicable
Author

John's solution looks simpler - that means better, if it works for you.

qlikview979
Specialist
Specialist

Hi

Try like this

=sum({<YEAR={">=$(=(AddMonths(Max(YEAR),-2)))<=$(=(AddMonths(Max(YEAR),-1)))"}>}SAL

Regards,

Mahesh.