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

Announcements
Qlik Open Lakehouse is Now Generally Available! Discover the key highlights and partner resources here.
cancel
Showing results for 
Search instead for 
Did you mean: 
rcorcoran
Creator
Creator

adding months in a variable

Hi I have a variable I am using to show current monthminus1 data and it works fine

=floor(AddMonths(vnp_CurrentMonth, -1))

the vnp_currentMonth is a variable that takes the selected month and is used in the above:

=floor(MonthStart(vSelectedYearMonth))

so the above will show data for the selected month minus one month.  I want a variable that will add the current month-1 the current month-2 and the current month-3 so for instance if January is selected it will add the data for Oct, Nov and Dec and display them.

The full expression that uses this for your information is:

NUM(SUM({<[PA2]={21}, DateNo={'$(vnp_CurrentMonthMinus1)'}, ReferredMM=, YearMonth=>}ActualValue), '#,##0'),

Any help appreciated

1 Reply
rcorcoran
Creator
Creator
Author

Actually sorry I just figured it out straight after posting this:

NUM(SUM({<[PA2]={21}, DateNo={'$(vnp_CurrentMonthMinus1)','$(vnp_CurrentMonthMinus2)','$(vnp_CurrentMonthMinus3)'}, ReferredMM=, YearMonth=>}ActualValue), '#,##0'),