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

1 Solution

Accepted Solutions
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)

View solution in original post

13 Replies
sunny_talwar

May be try this?

If(Count({<Date, [Status] = {'Value 1'}>} [Tag_ID]) >= 20, $(vRed), $(vGreen))

scheibercamo
Contributor III
Contributor III
Author

Just tried - didn't work By the way - the only reason I included the "Date=" in the color expression is because I have that in my original expression. I tried removing it from your solution and it still didn't work.

Do I need to include that part of the set analysis?

sunny_talwar

Can you show how exactly do you define vRed and vGreen?

scheibercamo
Contributor III
Contributor III
Author

vRed = RGB(255,79,77)

vGreen = RGB(0,198,64)

sunny_talwar

Just out of curiosity, does this work?

If(Count({<Date, [Status] = {'Value 1'}>} [Tag_ID]) >= 20, RGB(255,79,77), RGB(0,198,64))

scheibercamo
Contributor III
Contributor III
Author

No Perhaps you can share an example of bars within a chart colored by expression that I could use as a baseline? 

sunny_talwar

Here is a very simple mock up for you

Capture.PNG

scheibercamo
Contributor III
Contributor III
Author

Do you have the expression behind this chart? For the general one and the background color. Thanks!

I'm working in Qlikview by the way.

sunny_talwar

You opened your thread in Qlik Sense forum that is what confused me... here is a QlikView sample and image

Capture.PNG