Qlik Community

Qlik Sense App Development

Discussion board where members can learn more about Qlik Sense App Development and Usage.

Employee
Employee

Qlik Sense Calculating Variables in an 'IF' Statement

Hi Everyone, i have an If statement on the fly on a Qlik sense object

If(condition a=true, $(vVariable1),

     if(condition b=true, $(vVariable2),

          if(condition c=true, $(vVariable3),

                if(condition d=true, $(vVariable4),

                    if(.......................................................................))))...


Now naturally  all the variables 1-4 will evaluate first then the If conditions however what i want to do is only evaluate the variable if the condition is met first.. My actual script contains over 30 nested IF's and on each click on a filter evaluates all the variables and then the condition leading to extremely slow performance.


Has anyone identified a way to tackle this in a simple way

Tags (2)
3 Replies

Re: Qlik Sense Calculating Variables in an 'IF' Statement

Hi,

It is not the variable which is creating issue. It is the if statement which is giving you the performance issue.

You must use the different approach for your expression.

Regards,

Kaushik Solanki

Highlighted
duffman1968
New Contributor III

Re: Qlik Sense Calculating Variables in an 'IF' Statement

Hey Naweed,

Have you considered taking care of more of these conditions in the data model? Say with more flags, or more of the combinations already predetermined?

When my interface conditional statements become overwhelming, I think push it back to the data model.

Good luck.

Regards,

Patrick

Employee
Employee

Re: Qlik Sense Calculating Variables in an 'IF' Statement

Hi Patrick

Yes i have, the purpose behind this is on the fly dynamic measures and dimension selection in a pivot table from data island list selection.

Yes the ideal way would be to remove the if statement and create a single table with changing expression, but im purposely trying to achieve everything in a single Pivot table. So here i basically want to somehow not calculate the variables until a condition is met on the fly to boost performance. what iv shown above is only a small snipped of the if statement each variable 1-4 has inner variables with complex calculation . Im trying to show the possibility of achieving this on the fly without the use of any extensions or plugins. The concept now works but its slow

Community Browser