Skip to main content
Woohoo! Qlik Community has won “Best in Class Community” in the 2024 Khoros Kudos awards!
Announcements
Nov. 20th, Qlik Insider - Lakehouses: Driving the Future of Data & AI - PICK A SESSION
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

Subtract values for rolling months

Hi,

I'm looking to subtract values from the current month with the Previous Year's same month, as in (May 2012 - May 2011) for a rolling period of 1 year. That is, the current month is May 2012, and its dynamic; I'm using a variable to capture both the dates but I'm not able to get the values for May 2011. Similarly I need the same for the previous 12 months. I'm using these values to plot a line graph to find the Trend.

The series am looking for:

(May 2012 - May 2011), (Apr 2012 - Apr 2011) and so on, for 12 values.

Please help me out!

Thanks & Regards,

Krishna

4 Replies
giakoum
Partner - Master II
Partner - Master II

Sum(Sales)

-

Sum({<MonthYear={"$(=AddMonths(MonthYear,-12))>} Sales)

assuming that MonthYear is your month field and Sales the value you are after.

Then limit the chart values to 12.

Not applicable
Author

Hi,

Thanks for your reply.

But the expression is not working, is there anything to do with the double quotes put before the dollar symbol? It treates the expression after the double quotes as field and when I remove it, its like a variable.

Sum(Sales) - Sum({<MonthYear={"$(=AddMonths(MonthYear,-12))>} Sales)

Thanks,

Krishna

giakoum
Partner - Master II
Partner - Master II

true I forgot to close them. Sorry!

Sum(Sales) - Sum({<MonthYear={"$(=AddMonths(MonthYear,-12))"}>} Sales)

a sample application would help if the syntax is still incorect.

Not applicable
Author

Hi Loannis,

The above expression is not working............

We need to have YEAR OVER YEAR Volume for 12 months,

For instance,

Jan12 Vol- Jan11Vol, Feb12Vol- Feb12Vol...........................

Thanx