Skip to main content
Announcements
Have questions about Qlik Connect? Join us live on April 10th, at 11 AM ET: SIGN UP NOW
cancel
Showing results for 
Search instead for 
Did you mean: 
raghavsurya
Partner - Specialist
Partner - Specialist

Multiple colour in bar chart for same expression

Hi All,

I need to get different colour for a Bar when the value is in negative.

For example : I have a bar chart where dimension is Cost centre with values A,B,C,D,E and profit is the expression where it shows five Bars for each cost centre. suppose if Cost centre D is have loss....the bar depicting net loss for cost centre should show in red colour wherein other bars should show in Green.

Is there a way to do it.

Thanks and Regards,

Raghav

1 Solution

Accepted Solutions
sparur
Specialist II
Specialist II

you should use background color expression. See in Expression tab on your expression and use like this:

if(sum(Amount )<0, red(), green())

View solution in original post

4 Replies
sparur
Specialist II
Specialist II

you should use background color expression. See in Expression tab on your expression and use like this:

if(sum(Amount )<0, red(), green())

kji
Employee
Employee

Add a Background color subexpression to your expression in which you put if(profit>0, Green(), Red()).

Not applicable

Hi Raghav,

Apart from color change, it is also possible to avoid shift in zero base of chart.

i.e. even negative value bar will go up (like positive values) but color will be changed.

Just look at the attachment.

Sincere Regards,

RBA

raghavsurya
Partner - Specialist
Partner - Specialist
Author

Hi All,

Thanks a lot.... its working for me.

Regards,

Raghav