Do not input private or sensitive data. View Qlik Privacy & Cookie Policy.
Skip to main content

Announcements
See why IDC MarketScape names Qlik a 2025 Leader! Read more
cancel
Showing results for 
Search instead for 
Did you mean: 
jjustingkm
Creator II
Creator II

Replace if condition in a field in Qlik sense table

I have a field that I am using to restrict data , something similar like below.

IF(sales_amount >0, country) , if there is sales amount only I display that country in the table then uncheck null field. I would like to know if there is anything I can do to replace if condition , not sure set analysis is feasible here since it is not a calculation.

Since If condition is used it is affecting the response time of the table.

 

Labels (1)
1 Solution

Accepted Solutions
marcus_sommer

Each UI object based on a virtual table which is derived from the underlying data-set - with a certain (specified) dimensionality and n expressions. Getting the appropriate dimensional-layer is quite resource-consuming and mostly single-threaded performed. The expression-evaluation happens afterwards and are instead to the dimensions mainly executed in multi-threads.

Therefore are filters in expressions per "real" set analysis often more performant as within dimensions. But as usual it depends on the specific use-case, for example is a single filter enough and applicable or would it necessary to repeat it in more/all dimensions/expressions and/or how the underlying data-model is designed and so on ...

Like above hinted it's not mandatory to find always the most performant way - within many scenarios you won't notice big differences and considerations in regard to complexity and maintainability might be more worth ...

View solution in original post

8 Replies
Oleg_Troyansky
Partner Ambassador/MVP
Partner Ambassador/MVP

Have you tried disabling "Include zero values" in the Data Handling section of the properties?

jjustingkm
Creator II
Creator II
Author

I am not brining any measures into the table. The sales I am using as a condition in a field.

anat
Master
Master

Aggr( Only({$<sales = {">=sum(sales) = 0"}>} country), country)

BrunPierre
Partner - Master II
Partner - Master II

=Aggr(Only({$<sales_amount = {">0"}>} country), country)

jjustingkm
Creator II
Creator II
Author

Thank you both, I thought about it, do you think this will have better performance over if condition. I heard aggr function also causes performance issues. I will test it on my end also.

marcus_sommer

The if-loop and the aggr() will have an impact on the performance whereby I guess that the aggr() with a "real" set analysis should perform better as the if-loop. Reason for this assumption is that the set analysis reduced the data-set before evaluating the remaining countries and the if-loop runs against the entire selection state. But it will also be depending of the data and the data-model. I think by rather smaller data-sets you won't notice a significant difference.

An alternatives may be to replace one of the dimensions with an appropriate expression and I could imagine that such approach is more performant as filtering the table with a calculated dimension. 

jjustingkm
Creator II
Creator II
Author

Hi Marcus, 

Can you explain it a bit more more if possible?

An alternatives may be to replace one of the dimensions with an appropriate expression and I could imagine that such approach is more performant as filtering the table with a calculated dimension. 

 

 

marcus_sommer

Each UI object based on a virtual table which is derived from the underlying data-set - with a certain (specified) dimensionality and n expressions. Getting the appropriate dimensional-layer is quite resource-consuming and mostly single-threaded performed. The expression-evaluation happens afterwards and are instead to the dimensions mainly executed in multi-threads.

Therefore are filters in expressions per "real" set analysis often more performant as within dimensions. But as usual it depends on the specific use-case, for example is a single filter enough and applicable or would it necessary to repeat it in more/all dimensions/expressions and/or how the underlying data-model is designed and so on ...

Like above hinted it's not mandatory to find always the most performant way - within many scenarios you won't notice big differences and considerations in regard to complexity and maintainability might be more worth ...