Skip to main content
Announcements
Qlik Introduces a New Era of Visualization! READ ALL ABOUT IT
cancel
Showing results for 
Search instead for 
Did you mean: 
hjm35055
Partner - Contributor III
Partner - Contributor III

Combine IF statement with Variable and Set Analysis

Hi,

I have a pretty large equation and I am trying to control a portion of set analysis with a variable and am not sure if it is possible.  

I have a variable: vShowHidePeriod = 1 or 0 depending on the variable input button.

If vShowHidePeriod = 1 then I want 'LMTD_Flag={'1'}' to display in the set analysis, if vShowHidePeriod = 0, then I want 'LMTD_Flag=' to show in the set analysis.

Equation I am trying to accomplish:

Count({<EncounterCategory1-={'Non-Encounter Charges'}, IF($(vShowHidePeriod)=1, 'LMTD_Flag={'1'},', 'LMTD_Flag=,')) >} DISTINCT EncounterUID)

Thanks in advance!

3 Replies
jwjackso
Specialist III
Specialist III

I've done something similar in Qlikview.  Instead of having the button set the variable to 1 or 0, have it set the Set Analysis expression LMTD_Flag = {'1'} or LMTD_Flag=

Then in the expression use the variable, Count({<EncounterCategory1-={'Non-Encounter Charges'},$(vShowHidePeriod)>}Distinct EncounterUID)

hjm35055
Partner - Contributor III
Partner - Contributor III
Author

I thought about that.  The problem is, I want this variable to control additional set analysis on this sheet such as MTD_Flag, YTD_Flag, and LYTD_Flag.  

I have a sheet of 10+ KPIs and they are currently set to show the current MTD, LMTD, YTD, and LYTD when you open it.  I want to create a variable controlled by an ON or OFF button to allow for dynamic date selection.  Essentially says to use date flag set analysis or ignore the date flag set analysis.

JMAROUF
Creator II
Creator II

hello @hjm35055 

did you tried this?

=if(vShowPeriode=1, count({<EncounterCategory1-={'Non-Encounter Charges'},LMTD_Flag={1}>} DISTINCT ID),
count({<EncounterCategory1-={'Non-Encounter Charges'},LMTD_Flag=>} DISTINCT ID))