Skip to main content
Announcements
Introducing Qlik Answers: A plug-and-play, Generative AI powered RAG solution. READ ALL ABOUT IT!
cancel
Showing results for 
Search instead for 
Did you mean: 
newbie_sm
Contributor III
Contributor III

Previous Month expression

I have set the following  expression:

(
Sum({<Month={'$(=Max([Month], 'YYYY-MM'))'}>} Revenue)
/
Sum({<Month={'44927'}>} Revenue)
)
-1

where {<Month={'$(=Max([Month], 'YYYY-MM'))'}>} is Current Month

How can I set a similar expression for calculating Previous Month?  I tried this but it doesn't work:

{<Month={'$(=Max([Month]-1, 'YYYY-MM'))'}>}

Labels (2)
10 Replies
newbie_sm
Contributor III
Contributor III
Author

In addition, when I used this format

(Sum({<[Month Year]={'$(=Max(Date([Month Year], 'YYYY-MM')))'}>} USD_Revenue) / Sum({<[Month Year]={'$(=Max(Date([Month Year]-1, 'YYYY-MM')))'}>} USD_Revenue)) -1

both months format returned in YYYY-MM i.e. 2023-02 and 2023-01, but the calculation is still not returning properly