Skip to main content
Announcements
Join us at Qlik Connect for 3 magical days of learning, networking,and inspiration! REGISTER TODAY and save!
cancel
Showing results for 
Search instead for 
Did you mean: 
tan_chungkam
Creator
Creator

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.

Excel TableExcel TableSriptingSriptingVariables 2Variables 2Variables 1Variables 1Set Analysis for  Total New OrderSet Analysis for Total New OrderSet Analysis for Compare Last MonthSet Analysis for Compare Last MonthThe outcome when i filter 'YearPeriod' (Correct)The outcome when i filter 'YearPeriod' (Correct)The outcome when i filter 'Year' and 'Period' (Wrong)The outcome when i filter 'Year' and 'Period' (Wrong)

Labels (3)
1 Solution

Accepted Solutions
zzyjordan
Creator II
Creator II

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

View solution in original post

3 Replies
zzyjordan
Creator II
Creator II

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
Creator
Creator
Author

@zzyjordan,

It works perfectly.

Appreciate if you could explain what have you did? 

Thanks.

zzyjordan
Creator II
Creator II

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