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: 
infock12
Creator III
Creator III

Stacked Bar Chart uneven colours

Hi All,

I am creating two stacked bar charts (please see attached). I have given the below variables for colours under Expressions > Background Colour.

=if([Rating]>12, RGB(255, 0, 0),
if([Rating] >=8 and [Rating] <=12, RGB(255, 153, 0), RGB(255, 255, 0))

The colours are all over the place. It is working in some bars and not working in others, which is strange. For example, if you select "CFN" under Response list box, it works fine (1 yellow, 1 amber, 1 red). However, if you select "Doc", in spite of giving the right values on the bars, there is a same colour. There seems to be something very simple that is wrong. Please help.

Thanks,

Karthik

1 Solution

Accepted Solutions
kji
Employee
Employee

Try using Avg(Rating) instead of just rating.

Also "and [Rating] <=12" is superfluous since you already got rid of the with the first if.

View solution in original post

2 Replies
kji
Employee
Employee

Try using Avg(Rating) instead of just rating.

Also "and [Rating] <=12" is superfluous since you already got rid of the with the first if.

infock12
Creator III
Creator III
Author

Hi Jodan,

Thanks for the quick reply. I tried

=if(Avg([Risk Rating])>12, vRed,
if(Avg([Risk Rating])>=8, vAmber, vGreen))

and it worked!!