Skip to main content
Showing results for 
Search instead for 
Did you mean: 
Contributor II
Contributor II

Qlik sense performance: slowlness issues IF statement



I need your help please.

I have a qlik sense application with many graphigs, in each graphics I used an expression with IF statement which causes a much slowness and some graphigs don't display sometimes.

if(GetSelectedCount(field1)=0 and GetSelectedCount(field2)=0 and GetSelectedCount(field3)=0,
Sum({<set analysis>} field4),
if(GetSelectedCount(field1)>0 and GetSelectedCount(field2)=0 and GetSelectedCount(field3)=0,
Sum({<setanalysis>} field4),
if(GetSelectedCount(field1)>=0 and (GetSelectedCount(field2)>0 and GetSelectedCount(field3)=0,
Sum({<set analysis>} field4),

I tried to implenement the conditions in the script but I don't know how replace the function: GetSelectedCount()

How can I avoid the use of IF or how can I replace it please?

Thank you in advance.


Labels (2)
3 Replies

This could probably be done with straight up set analysis, but I like mathematical solutions better than complicated set analysis, so I'd go about it that way personally. You should be able to do this with logical operators. Not sure if this will improve performance, since I haven't tried, but I think it should be efficient.


(-(GetSelectedCount(Field1)=0 AND GetSelectedCount(Field2)=0 AND GetSelectedCount(Field3)=0)

* Sum({<set analysis>} field4))


(-(GetSelectedCount(Field1)>0 AND GetSelectedCount(Field2)=0 AND GetSelectedCount(Field3)=0)

* Sum({<other set analysis>} field4))


Each AND of this will return 0 for the conditional aspect if the conditions are not met, so that entire section will return 0 and not impact the result. It will return -1 (which we are turning into 1 using the negative sign) if all conditions are true, so we are multiplying by 1 and not changing the sum.




Try to check, the set analysis logic too and check the open , closed brackets b/w different conditions for where you were started it & ended it. If brackets () were not placed properly, selection won't pass properly, hence QlikSense not able to execute the proper set analysis condition.

Contributor II
Contributor II


it is just an extract of my expression.

The expression works and the graphics display, I have just a problem of slowness.

I search to replace the if (string) by other way more performed.