Do not input private or sensitive data. View Qlik Privacy & Cookie Policy.
Skip to main content

Announcements
Join us to spark ideas for how to put the latest capabilities into action. Register here!
cancel
Showing results for 
Search instead for 
Did you mean: 
YiannisK
Contributor
Contributor

Current vs Previous month

Hi All, I am try to compare month versus previous month based on the selected month in calendar filter.

For example, if I select Feb 2022, I would like to have the % difference versus Jan 2022 etc.

At the moment I have the below which work only for current month but not for previous.

Sum({<Year={'$(=Max(Year))'}, Month={'<=$(=Max(Month))'}> + <Year={'<$(=Max(Year))'}, Month=>} GCF)

/

Sum({<Year={'$(=AddYears(Max(Year))-1'}, Month={'<=$(=AddMonths(Max(Month))-1'}> + <Year={'<$(=AddYears(Max(Year))-1'}, Month=>} GCF)

Could you please help?

Thank you!!

Labels (1)
2 Replies
Mario_De_Felipe
Luminary
Luminary

Perhaps the easiest way is using Date fields, something like this:

 

SUM({<[Date]={"<='$(=MonthEnd(Max([Date])))'"},Year=,Month=,YearMonth=>} GCF)/SUM({<[Date]={"<='$(=MonthEnd(AddMonths(Max([Date],-1))))'"},Year=,Month=,YearMonth=>} GCF)

YiannisK
Contributor
Contributor
Author

Thank you for the reply and time Mario!

The above is not working as the result is zero. I tried them separately as to test and again there is no result appearing. Seems the YearMonth=> is not working. Any thoughts?