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

Another problem with Set Analysis

Sorry, but for me it is not easy to use the Set Analysis.

I would like to make a table (see Table 1 of the attached file) in which, for each city,

I get sales from the beginning of the year up to the maximum month.

In another column reports I get the values of sales for the same period

but reported the previous year.

If I select Dec/2012 it works well. I get the year 2012 in the first

column and the year 2011 in the second column.

Instead if I select the variable year = 2012, I would have the same result

as before. For the first column I get the correct value.

For the second column I have the value 0!

How can I do to run the 2 cases correctly?

THANK ALL

1 Solution

Accepted Solutions
Not applicable
Author

For the previous year expression use this:

Sum (  {<Year=,YearMonth={">=$(=date(addmonths(YearStart(max(YearMonth)),-12),'MMM/YY'))<=$(=date(addmonths(max(YearMonth),-12),'MMM/YY'))"}>}                       

                    Sales) 

The only difference with your version is the " Year= ". This will make QlikView disregard the Year selection in order to be able to select those YearMonth that don't exist in the selected year, which are the ones that you're setting with the YearMonth set analysis.

View solution in original post

4 Replies
Anonymous
Not applicable
Author

use this expression

 

Sum

( {<Year=,YearMonth={">=$(=date(addmonths(YearStart(max(YearMonth)),-12),'MMM/YY'))<=$(=date(addmonths(min(YearMonth),-12),'MMM/YY'))"}>}
Sales

)

hope this solves the issue

Not applicable
Author

Hi srikanthsri1,

than a lot.

But it non work well.

i risultati delle 2 tabelle sono diversi.

Puoi caricare il tuo esempio? 

thank  1000

Not applicable
Author

For the previous year expression use this:

Sum (  {<Year=,YearMonth={">=$(=date(addmonths(YearStart(max(YearMonth)),-12),'MMM/YY'))<=$(=date(addmonths(max(YearMonth),-12),'MMM/YY'))"}>}                       

                    Sales) 

The only difference with your version is the " Year= ". This will make QlikView disregard the Year selection in order to be able to select those YearMonth that don't exist in the selected year, which are the ones that you're setting with the YearMonth set analysis.

Not applicable
Author

Hi Carlos,

thank very much

  Sbuzi