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: 
jperella12
Contributor
Contributor

Nested IF to change bar color

I am trying to create a nested IF function that will change the color of the bars in a chart based on if they hit a certain criteria. For example I currently have an IF function that state if the actual amount is over budget, then the bar should be green. If its under budget, then it should be red. I need to add to that IF function that if the actual amount is only under budget by less than 10 dollars, then make the bar yellow.

 

Any help on this would be much appreciated!

 

#

Labels (7)
1 Reply
Dalton_Ruer
Support
Support

Disclaimer: I took the quick way out using the default color functions. Please - please - please - please use better colors 🙂

Here is the data I used and the expression I created:

MyData:
Load * inline [
Key, Budget, Actual
A, 100, 125
B, 100, 91
C, 100, 75
];

If(Budget-Actual>10, Red(),
If(Budget-Actual>0, Yellow(),
Green()))

Here is the result:

ActualRedGreenYellow.png