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: 
Manuel93
Contributor II
Contributor II

If statement on Dimension based on variable QLIK SENSE

Hi experts,

I'm facing 2 different problems on the same issue, 

I'm trying to implement a dimension on different tables that depends on a variable I set using a button in the dashboard.

I have different region hierarchies, and depending on the user, they can choose which region hierarchy to see.

1 case:

=if('$(v_Region)'='AG',Region,if('$(v_Region)'='CE',Alt_Region,Fs_Region))

it logically works but in the selection filter I don't see the filter selected, but instead the if statement:

Manuel93_0-1661505183465.png

 

2 case:

I have to use the same logic but with another condition that is used to show SUb_region only if I have selected 1 and only 1 value of the possible region hierarchies:

=if((GetSelectedCount(Region)+GetSelectedCount(Alt_Region)+GetSelectedCount(Fs_Region)=1),SubRegion,if('$(v_Region)'='AG',Region,if('$(v_Region)'='CE',Alt_Region,Fs_Region))) 

the logic of the 'getselectedcount' works, but when I select a specific region from the rows of the table I get this selection I can't explain:

Manuel93_1-1661505470348.png

It seems to me that it is selecting the right scope on the Model but selecting on every Field instead of the single one it should, in this case ALT_REGION.

Thank you all

Manuel

Labels (1)
3 Replies
brunobertels
Master
Master

hi 

may be this for first issue

=if($(v_Region)='AG',Region,if($(v_Region)='CE',Alt_Region,Fs_Region))

deepanshuSh
Creator III
Creator III

First of all you need to remove the quotes present around where you have called the variable as mentioned by Bruno Before for both the expressions. Second you first need to check the get selected count expression in a KPI or text is it giving you the correct outcome, as you are trying to select 3 fields and then trying to compute them through the get selected count function, as there are three inputs you need to verify their output before going into if expression. 

 

Trial and error is the key to get unexpected results.
vinieme12
Champion III
Champion III

This is how it work's , you have a calculated filter condition that aggregates on multiple fields,

simply because this does not actually create a new field! but a combination of filters

 

 

 

Vineeth Pujari
If a post helps to resolve your issue, please accept it as a Solution.