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

Text and image object with calculation condition

Hi Qlik Community,

I am struggling with a calculation which is fairly heavy causing my whole report to run slowly.
However, the calculation is only relevant if the user has made some selections.
I would therefore like to add a calculation condition so that the calculation is only evaluated if the user has made selections.

It seems like I am only able to use calculation conditions in KPI's. However, it is required that I use text and image objects in the report... 

Does anyone know a way to implement calculation conditions on a text and image object or alternatively apply a calculation condition directly on the measure? 

 

Cheers

 

 

Labels (3)
1 Solution

Accepted Solutions
naumanshah
Contributor III
Contributor III

It will just evaluate "Show condition for chart" and if it is true, it will show that particular visualization.

You may add it like:

Capture.JPG

Capture2.JPG

View solution in original post

7 Replies
vunguyenq89
Creator III
Creator III

How about using an IF condition with GetSelectedCount() function to check whether there are any current user selections on particular fields? For example

=If(GetSelectedCount(City) = 0, 'Please select at least one city', Sum(Sales))

BR, 

Vu Nguyen 

NicolaiF
Partner - Contributor II
Partner - Contributor II
Author

That was my initial though as well. However, I found out that Qlik sense evaluates all inputs in an IF-statement no matter what condition is fulfilled in the statement. 

Example in the expression below both "Expression1" and "Expression2" will be evaluated no matter the size of "A". 
It evaluates all inputs and returns the correct one. 

IF(A>1, 
[Expression1],
[Expression2])

vunguyenq89
Creator III
Creator III

It's strange. The IF condition works in my example below

exptest.png

Can you share the expression and maybe some sample data?

naumanshah
Contributor III
Contributor III

You may also explore Custom Objects > Show/hide container

 
NicolaiF
Partner - Contributor II
Partner - Contributor II
Author

The expression works, yes.

But Qlik will evaluate both expressions - As in it will use CPU's and calculation time to calculate both expressions. 
It will return the right result yes, but even if you do something like:

IF(GetSelectedCount(Field1)<2, 0, [Heavy expression])

your measure will still run slow because it evaluates the 'heavy expression' before returning the value '0'... 
It is just qlik functionality..  

NicolaiF
Partner - Contributor II
Partner - Contributor II
Author

Does the Hide/show container evaluate all the visualisations when it is used?

Or does it first evaulate when the "Show condition for chart" is fulfilled? 

naumanshah
Contributor III
Contributor III

It will just evaluate "Show condition for chart" and if it is true, it will show that particular visualization.

You may add it like:

Capture.JPG

Capture2.JPG