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

Announcements
Join us in NYC Sept 4th for Qlik's AI Reality Tour! Register Now
cancel
Showing results for 
Search instead for 
Did you mean: 
anindya_manna
Creator II
Creator II

Convert this expression into set expression

Below expression is for calculating previous month.

=date(AddMonths(date#(max([FSPM Month Number]),'YYYYMM'),-1),'YYYYMM')

I want to calculate previous month based on date filter. It should not affected by any other selection like product name and rep id.

Bu using above normal exp. previous month calculation is changing as per selection like product name and rep id

3 Replies
tresesco
MVP
MVP

Like this?

=date(AddMonths(date#(max( {<product, repid, anyotherfield>} [FSPM Month Number]),'YYYYMM'),-1),'YYYYMM')


Note: If you want this to be unresponsive to any selection, you could just use {1}, like


date(AddMonths(max( {<1>} [FSPM Month Number]),-1),'YYYYMM')


Note: Here date#() is redundant (assuming your expression was a working one).

Clever_Anjos
Employee
Employee

Try this

Sum({1<[FSPM Month Number]={"$(=date(AddMonths(date#(max([FSPM Month Number]),'YYYYMM'),-1),'YYYYMM'))"}>} yourvaluefield)

Clever_Anjos
Employee
Employee