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

Announcements
Join us at Qlik Connect 2026 in Orlando, April 13–15: Register Here!
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

Previous Year Same month Set Analysis

Hi All,

I want to take the sum of previous year same month based on my month selection. For that i wrote like this below,

 

Sum

( {<Year=,
Month =,
SALES_DATE = {"$(=date(MonthName(AddMonths((max(SALES_DATE)), -12)),'YYYYMM')"}
>} Sales Cost

But its not working. What im doing wrong here..  My Sales date format is YYYYMM

Thanks,

Selva

Labels (1)
1 Solution

Accepted Solutions
swuehl
Champion III
Champion III

I do still count 6 opening '(' vs 5 closing brackets ')'... Check your syntax, add a closing bracket at the end of your search string.

View solution in original post

4 Replies
swuehl
Champion III
Champion III

Please double check your closing brackets, it seems you missed the last closing one.

Then, you probably don't need the MonthName function at all, or why do you think you need it here?

Check that your get the correct result returned when using

=date(MonthName(AddMonths((max(SALES_DATE)), -12)),'YYYYMM')

in a text box.


Not applicable
Author

Hi Swuehl,

Thanks for you reply.  Initially i tried in Text box after that only i tried to implement the same in set Analysis. As you said MonthName is not required.

Still its not working for me in set analysis. Now my set is like this.

 

Sum

( {<Year=,
Month =,
SALES_DATE = {"$(=date((AddMonths((max(SALES_DATE)), -12)),'YYYYMM')"}
>} SALES_
Cost )

Selva

swuehl
Champion III
Champion III

I do still count 6 opening '(' vs 5 closing brackets ')'... Check your syntax, add a closing bracket at the end of your search string.

Not applicable
Author

Yes, its an mistake in syntax.. Thanks for your time Swuehl