Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
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
@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)
@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)
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.