Qlik Community

QlikView Scripting

Discussion Board for collaboration on QlikView Scripting.

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

Re: Previous Year Same month Set Analysis

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

4 Replies
MVP
MVP

Re: Previous Year Same month Set Analysis

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

Re: Previous Year Same month Set Analysis

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

MVP
MVP

Re: Previous Year Same month Set Analysis

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

Re: Previous Year Same month Set Analysis

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

Community Browser