Skip to main content
Announcements
Introducing a new Enhanced File Management feature in Qlik Cloud! GET THE DETAILS!
cancel
Showing results for 
Search instead for 
Did you mean: 
bobnewbie
Contributor II
Contributor II

How to add the addmonth function to the following set analysis?

sum({<YearMonth={$(=$(vEndMonth)-2)}>} Sales)

Please assist, how would I add the addmonth function to the script above and replace the above -2?

The variable vEndMonth is set to:

=MAX(YearMonth)

Many thanks

3 Replies
Anil_Babu_Samineni

You can use this, May be?

=Sum({<DATE={"$(=AddMonths(vEndMonth,-2))"}>} SALES)



Best Anil, When applicable please mark the correct/appropriate replies as "solution" (you can mark up to 3 "solutions". Please LIKE threads if the provided solution is helpful
sunny_talwar

I would still use YearMonth field in the set analysis here and add Date() function to fix the format....

=Sum({<YearMonth = {"$(=Date(AddMonths(vEndMonth, -2), 'YYYY-MMM'))"}>} SALES)

Replace YYYY-MMM with the format for YearMonth field

Anonymous
Not applicable

First set vEndMonth= Max( Month( Date));

sum({<Date={'$(=addmonths(vEndMonth,-2))'}>}Sales)