Qlik Community

QlikView App Dev

Discussion Board for collaboration related to QlikView App Development.

Announcements
Customer & Partners, DEC. 9, 11 AM ET: Qlik Product & Strategy Roadmap Session: Data Analytics REGISTER NOW
cancel
Showing results for 
Search instead for 
Did you mean: 
kev6brown
Partner
Partner

Max Month minus 1

Hi,

 

I have the expression - Count({<ADMIT_MNTH = {"$(=Max(ADMIT_MNTH))"}>}[Patient]) which gives me the max month but i know need the same expression but the previous month so MINUS 1

 

Thanks

 

Kev

6 Replies
dilipranjith
Partner
Partner

use addmonths function with -1

Count({<ADMIT_MNTH = {"$(=AddMonths(Max(ADMIT_MNTH),-1))"}>}[Patient])

 

kev6brown
Partner
Partner
Author

Comes through as zeros
dilipranjith
Partner
Partner

check output of this expression in a text object and check

 

AddMonths(Max(ADMIT_MNTH),-1)

Kushal_Chawda

try below

assuming ADMIT_MNTH format is MMM YYYY.  In below set you can try giving actual format

Count({<ADMIT_MNTH = {"$(=date(addmonths(Max(ADMIT_MNTH),-1),'MMM YYYY'))"}>}[Patient])

kev6brown
Partner
Partner
Author

That gives me the previous month but in the format 01/06/2020 maybe that's why
dilipranjith
Partner
Partner

@kev6brown wrap it with date and try