Skip to main content
Announcements
Qlik Connect 2024! Seize endless possibilities! LEARN MORE
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

1 Solution

Accepted Solutions
swuehl
MVP
MVP

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
MVP
MVP

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
MVP
MVP

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