Skip to main content
Announcements
Qlik Connect 2024! Seize endless possibilities! LEARN MORE
cancel
Showing results for 
Search instead for 
Did you mean: 
Anonymous
Not applicable

Selected Month Year comparison with Previous Year Month

Hi Friend,

I've a requirement when I select a month in current year (ex: Mar 2016 or Apr 2016) it has to show the values till last 12 months ie Mar 2015 or Apr 2015.

Please help me for getting the logic.

Thanks in advance

Anusha

2 Replies
Kushal_Chawda

Create the MonthYear Field using Date(MonthStart(Date),'MMM YYYY') as MonthYear

Now write below expression

=sum({<MonthYear={">=$(=addmonths(max(MonthYear),-11))<=$(=max(MonthYear))"}>} Value)

sunny_talwar

Or you can just stick with dates:

Sum({<Date = {"$(='>=' & Date(MonthStart(AddYears(Max(Date), -1)), 'YourDateFieldFormatHere') & '<=' & Date(MonthEnd(Max(Date)), 'YourDateFieldFormatHere'))"}>}Value)

Here replace YourDateFieldFormatHere with the format that your datefield is in