Skip to main content
Announcements
Join us at Qlik Connect for 3 magical days of learning, networking,and inspiration! REGISTER TODAY and save!
cancel
Showing results for 
Search instead for 
Did you mean: 
kev6brown
Partner - Creator II
Partner - Creator II

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
dplr-rn
Partner - Master III
Partner - Master III

use addmonths function with -1

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

 

kev6brown
Partner - Creator II
Partner - Creator II
Author

Comes through as zeros
dplr-rn
Partner - Master III
Partner - Master III

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 - Creator II
Partner - Creator II
Author

That gives me the previous month but in the format 01/06/2020 maybe that's why
dplr-rn
Partner - Master III
Partner - Master III

@kev6brown wrap it with date and try