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: 
Anonymous
Not applicable

Change Color of Gauge Chart Based on IF Statement

Hi Everyone,

I am attempting to set the text color in a gauge chart based on the following if statement:

=if(sum(rm_LINESPICKED) / (sum(rm_LINESPICKED) + SUM(rm_LINES)) < 0.33, RGB(0,240,120),

  if(sum(rm_LINESPICKED) / (sum(rm_LINESPICKED) + SUM(rm_LINES)) >= 0.33 and sum(rm_LINESPICKED) / (sum(rm_LINESPICKED) + SUM(rm_LINES)) < 0.66, RGB(40,240,120),

  RGB(60,240,120)))

The expression "sum(rm_LINESPICKED) / (sum(rm_LINESPICKED) + SUM(rm_LINES))" evaluates to 0.31, so I would like for the color to be RGB(0,240,120). However, the color is defaulting to  RGB(60,240,120).

I have looked through similar posts but I have not been able to find a correct answer. Does anybody see what I am doing wrong?

Thanks!

Michael

3 Replies
JonnyPoole
Former Employee
Former Employee

can you share the app?  ... or a perhaps a qvw built off sample data that shows the issue

Anonymous
Not applicable
Author

Jonathan, I unfortunately cannot share the app.

Here is a screenshot based off the raw data. The number displayed in the gauge chart is sum(rm_linesshipped).

I would like to change the LED color based on the % of total lines shipped. I am calculating % of total lines shipped as:

sum(rm_linesshipped) / (sum(rm_linestoship) + sum(rm_linesshipped)) as the % of total lines shipped.

I am attempting to change the LED color based on an IF statement similar to this:

if % shipped < 0.33, then LED = red

if 0.33 <= % shipped < 0.66, then LED = yellow

if 0.66 <= % shipped, then LED = green

In this case, 0% of the lines have been shipped, so the LED color should be red.

2014-11-05_1333.png

maxgro
MVP
MVP

an example in attachment