Qlik Community

New to Qlik Sense

Discussion board where members can get started with Qlik Sense.

Announcements
Qlik® Product Spotlight: Discover what’s possible. Get more from our products.
See for yourself. Register today.
wajihakhan
New Contributor III

Prior Month

Hi

I have a field monthyear in this 'Jan-14' format.

Now i want to minus one month from this monthyear field

so i made a variable vPrvmonth in which i set an expression as

=Date(Addmonths(max(monthyear), -1),'MMM')

This variable is working fine and giving me a prior month from the month i have selected.

Like i have selected March then it is giving me Feb.

Now when i am using this variable in my expression for a measure then i got blank results.

I have tried so many expressions but not getting any result

Sum({<monthyear = {'$(vPrvmonth)'}>}M2)

Sum({<Month = {'$(vPrvmonth)'}>}M2)

What i am missing? What is the right expression?

Please guide me

Thanks

2 Replies
mdmukramali
Valued Contributor III

Re: Prior Month

Hi,

vPrvmonth

=Date(Addmonths(max(monthyear), -1),'MMM-YY')

Variable date format should be Month Year.

Because monthyear field format also Monthyear..

wajihakhan
New Contributor III

Re: Prior Month

I have changed the format but still not getting the desired result.

Actually there is some issue in below expression of measure where the variable is used

Sum({<monthyear = {'$(vPrvmonth)'}>}M2)

Sum({<Month = {'$(vPrvmonth)'}>}M2)