Qlik Community

QlikView App Development

Discussion Board for collaboration related to QlikView App Development.

Announcements
Make your voice heard! Participate in the 2020 Wisdom of Crowds® Survey. BEGIN SURVEY
Highlighted
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
Highlighted
Not applicable

Re: Another problem with Set Analysis

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
Highlighted
srikanthsri1
Valued Contributor

Re: Another problem with Set Analysis

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

Highlighted
Not applicable

Re: Another problem with Set Analysis

Hi srikanthsri1,

than a lot.

But it non work well.

i risultati delle 2 tabelle sono diversi.

Puoi caricare il tuo esempio? 

thank  1000

Highlighted
Not applicable

Re: Another problem with Set Analysis

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

Highlighted
Not applicable

Re: Another problem with Set Analysis

Hi Carlos,

thank very much

  Sbuzi