Skip to main content
Announcements
Have questions about Qlik Connect? Join us live on April 10th, at 11 AM ET: SIGN UP NOW
cancel
Showing results for 
Search instead for 
Did you mean: 
divya_anand
Creator III
Creator III

Qlik Sense - KPI Object - Conditional Colors

Hi,

I am trying to apply a condition for color in KPI object. I have 3 fields, I would like to show field "A" with color based on fields B & C.

If B>C then A should appear in red, otherwise in green.

Can someone help me achieve this?

I use QlikSense 2.2.4

7 Replies
devarasu07
Master II
Master II

Hi,

Try like below in your field A  background color properties,

your field A

=if(sum(Measure2)>sum(Measure3),Red(),Green())

refer sample app.

1.jpgUse below expression in

divya_anand
Creator III
Creator III
Author

Hi Devarasu,

I need this conditional color for KPI Object, not for a table.

devarasu07
Master II
Master II

Hi,

Can you share your app. tks

shraddha_g
Partner - Master III
Partner - Master III

Add 2 Limits with expression of Measure2 and Measure 3 and then select colors there.

arockiyaselvana
Partner - Creator
Partner - Creator

Hi, I am afraid we cannot achieve this directly. As a workaround, i think we can do the following.

1. first go to color settings in KPI Object. In QS 3.2, it is there under Appearance.

2. Enable the conditional color option.

3. Enter the expression in this format.

If(exp1>exp2, 0.75,0.25)

4. Arrange the limit scroll bar at the center if you want to use only two colors. Or add add more limits.

5. Choose the color from the list by click the on the bar.

kpi.PNG

P.S: You can select color from the list only.

julietotsch
Contributor II
Contributor II

I tried this, but now, my KPI (the first value) is very small. Is there a way to 1) make it bigger and/or 2) Hide the second KPI so it doesn't show in the box?
indujanT
Contributor II
Contributor II

Hi,

Instead of writing an IF condition, try this method: set the variable to your target variable.

For example: IF([Revenue - YTD] > [Last Yr Revenue], RGB(0,0,0), RGB(0,0,0)) 

In the IF condition, we are using [Last Yr Revenue] as the target value.

So, instead of writing the IF condition as an expression, set the measure value to  =[Last Yr Revenue]

indujanT_0-1688132276219.png

indujanT_1-1688132317463.pngindujanT_2-1688132337531.png

You can see from the results, when the current year revenue is higher than last year the colour is Green and when it's lower, the colour is Red

hope this will help you.