Skip to main content
Announcements
Introducing Qlik Answers: A plug-and-play, Generative AI powered RAG solution. READ ALL ABOUT IT!
cancel
Showing results for 
Search instead for 
Did you mean: 
AndrewMcIlwrick
Luminary Alumni
Luminary Alumni

Set Analysis and Nulls

Hi

In my report my set analysis expression for one pair of 'year' fields works perfectly, e.g. compare 2010 vs. 2009

SUM({$<SalesYear=CheckYear>} SalesVol)

I would like to be able to provide a facility to compare both a month and year e.g. Jan2010 vs. Mar2010. For this I used

SUM({$<SalesYear=CheckYear,SalesMonth=CheckMonth>} SalesVol)

This works fine when a year and month are both selected. However, it is very restrictive as I can no longer perform
the above 2010 vs. 2009 analysis because the month would be left blank.

I tried modifying the expression to incorporate an IF statement with IsNull logic but the set analysis syntax doesn't seem to
allow this.

Does anyone know if there is an easy way to do this without the use of variables or field content lists ? My example above is simplified from the final version where I would also like to provide similar fields for quarters, weeks and individual date comparisons !

Kind Regards
Andrew.

2 Replies
Not applicable

Hi

can you try an empty bracket to represent the null []

in my trials I had to bracket the comparison values, e.g.

SalesMonth={CheckMonth,[]}

to make it work

Regards

Juerg

Not applicable

Hi

You could try adding something into your expression to check if a month has been selected, so something like

IF(GetSelectedCount(CheckMonth)>0 , SUM({$<SalesYear=CheckYear,SalesMonth=CheckMonth>} SalesVol) , SUM({$<SalesYear=CheckYear>} SalesVol) )