Skip to main content
Announcements
Qlik Connect 2024! Seize endless possibilities! LEARN MORE
cancel
Showing results for 
Search instead for 
Did you mean: 
abe786
Contributor III
Contributor III

Avoid if else by using a calculation dimension

I'm trying to optimize performance of a dashboard by avoid use of if-else in my expressions. I have a condition in my expressions to perform calculation depending upon type of metric(in dimension), i.e. if metric is scalar perform one type of calculation, if it is non-scalar then perform other type of calculation. It works fine using if-else logic, however since both expressions are very slow overall time to load chart is high.

I was trying to create a calculation dimension, which will give get the required result upon type of Metric which is linked through the script. But it is not working, as per my expectation, as qlikview is unable to evaluate the value returned by this calculation dimension placed in the expression. See code attached, approach works fine when there is only type of metric (limited via listbox) but not for both.

Is there anyway I can get it working? or maybe another way to speed up my dashboard ?

Help appreciated, thanks

2 Replies
sunny_talwar

Slight improvement (not a whole lot) can be done by using Pick function instead of If

Pick(MT_Scalar_Flag + 1, count(Fact), sum(Fact))

abe786
Contributor III
Contributor III
Author

I tried it, you are right improvement is not that much..anyway thanks for your help