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

Announcements
Join us to spark ideas for how to put the latest capabilities into action. Register here!
cancel
Showing results for 
Search instead for 
Did you mean: 
Anonymous
Not applicable

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
Specialist III
Specialist III

Hi,

vPrvmonth

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

Variable date format should be Month Year.

Because monthyear field format also Monthyear..

Anonymous
Not applicable
Author

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)