Skip to main content
Announcements
Qlik Connect 2024! Seize endless possibilities! LEARN MORE
cancel
Showing results for 
Search instead for 
Did you mean: 
steeramp
Partner - Creator II
Partner - Creator II

IF Then Else statement .. impact with line chart and Set analysis

I have my filtre : TypeCA='Prestations saisies', Annee=2020 and Month= Mai

I would like change the Measure for every value of TYPECA and to show the timeline max(DATE ) -11 Months --> to Max(DateSelected) 

For example : for TypeCA='Prestations saisies' I want you use this expression:

(Sum({1<AnnulationDejaPayee={0}, Date={">=$(vDate_11)<=$(vMaxDate)"}, Annee= ,TypeCA=, Mois=>} Prest_Montant ) / Count(Distinct {1< Date={">=$(vDate_11)<=$(vMaxDate)"}, Annee= ,TypeCA=,Mois=>} [IDAgentSoin]) )

.. and without using the IF Statement , I have this perfect LINE :  (cool)steeramp_0-1601654224650.png

 but..... with the same filterssame SET ANALYSIS ,  if I use the IF THEN ELSE before the set analysis :

if(TypeCA='Prestations saisies',
(Sum({1<AnnulationDejaPayee={0}, Date={">=$(vDate_11)<=$(vMaxDate)"}, Annee= ,TypeCA=, Mois=>} Prest_Montant ) / Count(Distinct {1< Date={">=$(vDate_11)<=$(vMaxDate)"}, Annee= ,TypeCA=,Mois=>} [IDAgentSoin]) )
)

I have this result: only the value for the Mois=Mai is showed

steeramp_0-1601655223899.png

Why ?? How the IF THEN ELSE has an impact on my SET ANALYSIS??

1 Solution

Accepted Solutions
Kushal_Chawda

@steeramp  try with getfieldselections

if(getfieldselections(TypeCA)='Prestations saisies' , YourExpression, OtherExpression)

View solution in original post

4 Replies
Kushal_Chawda

@steeramp  try with getfieldselections

if(getfieldselections(TypeCA)='Prestations saisies' , YourExpression, OtherExpression)

steeramp
Partner - Creator II
Partner - Creator II
Author

You are the best one !! Can you explain the differences?

 

Kushal_Chawda

@steeramp  If condition tries to evaluate the expression row by row which could override the set expressions and generates inaccurate results. Whereas if you use getfieldselections it just looks at the  selection made and evaluates the expression as whole considering selection you made.

steeramp
Partner - Creator II
Partner - Creator II
Author

Great !