Skip to main content
Announcements
See what Drew Clarke has to say about the Qlik Talend Cloud launch! READ THE BLOG
cancel
Showing results for 
Search instead for 
Did you mean: 
dia2021
Creator
Creator

If calculation

Hi Everyone,

I am trying to set the background color based on the IF statement. I'm not sure if I can combine multiple conditions within the IF statement or not? Because calculation works fine when I run it separately along with the indicator, it doesn't work while I combine it with the IF clause. Please see the calculation below, and help me with fixing it. I have set up the indicator as a variable.

if (Only({<Goal_Metric={'Computer'}>} [Goal]) > sysvalue >= Sum({< Plan_Quarter ={'$(=MaxString(Plan_Quarter))'},[Plan_Metric]={'Computer'}>} [Plan_Value]), '$(vC_LightIndicator)')

Note: sysvalue is also a calculated field.

I'm trying to calculate if goalvalue > sysvalue >= planvalue then show this background color

Any suggestion is greatly appreciated!

Labels (2)
1 Solution

Accepted Solutions
Vegar
MVP
MVP

you can't do  a three way comparison like you do. You need to spilt them into two, like this.

if (Only({<Goal_Metric={'Computer'}>} [Goal]) > sysvalue AND sysvalue >= Sum({< Plan_Quarter ={'$(=MaxString(Plan_Quarter))'},[Plan_Metric]={'Computer'}>} [Plan_Value]), '$(vC_LightIndicator)')

View solution in original post

2 Replies
Vegar
MVP
MVP

you can't do  a three way comparison like you do. You need to spilt them into two, like this.

if (Only({<Goal_Metric={'Computer'}>} [Goal]) > sysvalue AND sysvalue >= Sum({< Plan_Quarter ={'$(=MaxString(Plan_Quarter))'},[Plan_Metric]={'Computer'}>} [Plan_Value]), '$(vC_LightIndicator)')

dia2021
Creator
Creator
Author

Thanks Vegar! It is working fine.

I have another question on the same syntax above as I need to apply the same syntax with multiple variations on the dashboard. I would like to create and capture Quarter as a variable so I can use it multiple times. Also, I'm not sure how can I use it with Sum function in set analysis, for example :

if (Only({<Goal_Metric={'Computer'}>} [Goal]) > sysvalue AND sysvalue >= Sum({< Plan_Quarter ={'$(=MaxString(Plan_Quarter))'},[Plan_Metric]={'Computer'}>} [Plan_Value]), '$(vC_LightIndicator)')

Syntax with Variable: How to use it with Sum function

if (Only({<Goal_Metric={'Computer'}>} [Goal]) > sysvalue AND sysvalue >= Sum({<'$(vPlanQtr)'},[Plan_Metric]={'Computer'}>} [Plan_Value]), '$(vC_LightIndicator)')

Thanks for your help!!