Qlik Community

New to Qlik Sense

Discussion board where members can get started with Qlik Sense.

Highlighted
tan_chungkam
Contributor

Set Analysis and Filter

Hi all,

I did some scripting and set analysis in my table.

My question is the kpi number is wrong when I filter the 'Year' and 'Period'.

However the kpi number is correct when i filter 'YearPeriod'.

Any ideas to fix this?

I would really prefer to put only 'Year' and 'Period' in the filter pane instead of 'YearPeriod'.

Please find attached my data and scripting. Thanks for the help.

image.pngExcel Tableimage.pngSriptingimage.pngVariables 2image.pngVariables 1image.pngSet Analysis for Total New Orderimage.pngSet Analysis for Compare Last Monthimage.pngThe outcome when i filter 'YearPeriod' (Correct)image.pngThe outcome when i filter 'Year' and 'Period' (Wrong)

1 Solution

Accepted Solutions
zzyjordan
Contributor II

Re: Set Analysis and Filter

Hi, Tan

Try this

count({<YearPeriod={'$(vMaxPeriod)'},OrderType={"New"},Year=,Period=>} distinct [Main Order])
-
count({<YearPeriod={'$(vPrevYearPeriod)'},OrderType={"New"},Year=,Period=>} distinct [Main Order])

Hope this helps

ZZ

3 Replies
zzyjordan
Contributor II

Re: Set Analysis and Filter

Hi, Tan

Try this

count({<YearPeriod={'$(vMaxPeriod)'},OrderType={"New"},Year=,Period=>} distinct [Main Order])
-
count({<YearPeriod={'$(vPrevYearPeriod)'},OrderType={"New"},Year=,Period=>} distinct [Main Order])

Hope this helps

ZZ

tan_chungkam
Contributor

Re: Set Analysis and Filter

@zzyjordan,

It works perfectly.

Appreciate if you could explain what have you did? 

Thanks.

zzyjordan
Contributor II

Re: Set Analysis and Filter

Hi, Tan

the purpose of adding the bold part is to let the set expression ignore the year and period selection in this case as your variables will take the calculation part of your selections.

Hope this makes sense 🙂
ZZ