Skip to main content
Announcements
See what Drew Clarke has to say about the Qlik Talend Cloud launch! READ THE BLOG
cancel
Showing results for 
Search instead for 
Did you mean: 
Lucky1
Creator
Creator

Ignore set analysis condition while applying filter

Hi,

I have filter 

Item

Cat1

Cat2

 

I have a kpi with expression

Count({<Item={'cat1'}>}id)

If I don't select anything my kpi is giving cat1 values.but if I select cat 2 in filter it should show cat2 values.how to do that.kPI values should change according to our selection in filter even if I apply set analysis 

 

Labels (4)
1 Solution

Accepted Solutions
Kushal_Chawda

@Lucky1  there are many ways you can do it.

 

Option 1: Simplest will be use if condition to see if there are any selection made  on that like below

=if(getselectedcount(Item)>0,
count(id), count({<Item={'Cat1'}>}id))

 

Option2 : Create variable vItem with below expression

=if(GetSelectedCount(Item)>0,'*','Cat1')

You can now use below expression using varible

=Count({<Item*= {"$(vItem)"}>}id) 

 

Option 3: You can use below set expression
=Count({<Item*= {'$(=replace(GetFieldSelections(Item,','),',',''','''))'}+{'Cat1'}>}id) 

 

 

 

View solution in original post

2 Replies
Kushal_Chawda

@Lucky1  there are many ways you can do it.

 

Option 1: Simplest will be use if condition to see if there are any selection made  on that like below

=if(getselectedcount(Item)>0,
count(id), count({<Item={'Cat1'}>}id))

 

Option2 : Create variable vItem with below expression

=if(GetSelectedCount(Item)>0,'*','Cat1')

You can now use below expression using varible

=Count({<Item*= {"$(vItem)"}>}id) 

 

Option 3: You can use below set expression
=Count({<Item*= {'$(=replace(GetFieldSelections(Item,','),',',''','''))'}+{'Cat1'}>}id) 

 

 

 

Prem0212
Creator
Creator

That is the major difference between IF condition and set analysis. If we use any specific condition in set analysis it will work irrespective of the filter. so that we can use the combination of set Analysis with if condition.

if(getselectedcount(Region)>0,
count(Quantity), count({<Region=>}Quantity))

Please like and accept the solution if it serves the purpose.