Skip to main content
Announcements
Introducing Qlik Answers: A plug-and-play, Generative AI powered RAG solution. READ ALL ABOUT IT!
cancel
Showing results for 
Search instead for 
Did you mean: 
M_J
Contributor
Contributor

Multiple Color bars and different for line in Combo Chart

Hi,

I want the bars (4 years - 4 bars) in different colors and the line in completely different color in the combo chart.

Years in x axis and sales and %  are in y axis. I tried the below code. It doesn't work. Can any one please correct the below code or give the alternate code for me?

if(Year=2015,(Sum([Sales]),rgb(166,166,166)), if(Year=2016,(Sum([Sales]),rgb(13,13,13)), if(Year=2017,(Sum([Sales]),rgb(255,0,0)),if(Year=2018,(Sum([Sales]), rgb(81,56,136)), Sum([Sales]),rgb(51,213,167)))))

4 Replies
Channa
Specialist III
Specialist III

if(Year=2015,rgb(166,166,166)), if(Year=2016,rgb(13,13,13)), if(Year=2017,rgb(255,0,0)),if(Year=2018,rgb(81,56,136)), rgb(51,213,167)))))

 

or

 

if(Year=2015 and Sum([Sales])>0,rgb(166,166,166), if(Year=2016 and Sum([Sales])>0,rgb(13,13,13), if(Year=2017and Sum([Sales])>0,rgb(255,0,0),if(Year=2018,(Sum([Sales]), rgb(81,56,136)), Sum([Sales]),rgb(51,213,167)))))

 

try to change ur expression

if(Year=2015 and Sum([Sales])>0,rgb(166,166,166),if(Year=2016 and Sum([Sales])>0,rgb(13,13,13)))

Channa
M_J
Contributor
Contributor
Author

Thanks for your response Channa. Since I am using this code as the measure expression (need to mention the measure) I can not use if(Year=2015,rgb(166,166,166)), if(Year=2016,rgb(13,13,13)), if(Year=2017,rgb(255,0,0)),if(Year=2018,rgb(81,56,136)), rgb(51,213,167))))). It works good in the color section as a condition under by expression. But the line color also gets changed according to the year. I need one solid color for the line regardless of the year.

if(Year=2015 and Sum([Sales])>0,rgb(166,166,166),if(Year=2016 and Sum([Sales])>0,rgb(13,13,13))) seems a very good logic.

But it is not working for me.

Channa
Specialist III
Specialist III

in that case you have to use extinction from VIZLIB

it has option to have conditional color by each measure

Channa
M_J
Contributor
Contributor
Author

Thank you Channa. I will try Vizlib extension...