Skip to main content
Announcements
Join us at Qlik Connect for 3 magical days of learning, networking,and inspiration! REGISTER TODAY and save!
cancel
Showing results for 
Search instead for 
Did you mean: 
scheibercamo
Contributor III
Contributor III

How do I color bars in a bar chart by expression (number range)?

Hi -

I am trying to color the below bars by expression, trying to go off a set analysis:


IF(COUNT({< Date=, [Status]={'Value 1'}>}[Tag_ID])>= 20, vRed,vGreen) WHERE vRed and vGreen are color variables.


For some reason, this set analysis isn't working even though I wrote this expression under "Background Color" for the chart. Ideally, what I would like to see is two Red bars (since these numbers are above 50) and a green third bar. Right now they are all red and this is not right.


Any advice on this? The expression behind the bar chart itself is:


=COUNT({<Date=,[Status={'Value 1'}>}[Tag_ID])


Thanks for your help in advance!


Ricky

13 Replies
scheibercamo
Contributor III
Contributor III
Author

Apologies. So you used the exact same expression as above, and this worked for you in Qlikview?

sunny_talwar

Since this was a mockup, I used this expression

=If(Sum(Tag_ID) >= 20, RGB(255,79,77), RGB(0,198,64))

Where my chart's expression is

=Sum(Tag_ID)

scheibercamo
Contributor III
Contributor III
Author

Thanks! This is also working with some dummy data of mine. Still trying to get it to work with my original data. Appreciate the help / affirmation that my approach was on the right path.

sunny_talwar

May be convert this bar chart of yours into a straight table and remove any labels from your expression so that we can see the chart's expression and its result in the straight table