Skip to main content
Announcements
Qlik Connect 2024! Seize endless possibilities! LEARN MORE
cancel
Showing results for 
Search instead for 
Did you mean: 
ts3st1000
Contributor
Contributor

Color Bar Chart

Hi, I have a bar chart displaying two variables, Foreign Sales and Domestic Sales that I draw one next to the other per product.

I am trying to have each one in different color and i tried the following under Colors and legend, Colors custom, By expression:

if('Foreign Sales', red() ,if('Domestic Sales', green()))

But the above did not work. Any suggestion how to fix this code please?

Thanks very much.

13 Replies
ts3st1000
Contributor
Contributor
Author

both are measures. what difference does that make please ?

i tried your suggestion, but both bars look red though !!

ts3st1000
Contributor
Contributor
Author

Thanks Omar. i tried this, and in defining the measure you can select its color. that worked. Thanks again.

OmarBenSalem

Good; if your question has been answered; then close the thread please by marking the correct answer as correct.

MK9885
Master II
Master II

To change color for your variable, you'd need to give some number

Ex:

if($(Foreign Sale)>1000,red(),

if($( Domestic Sales)>1000,green()))

The number can be anything as it is a color by expression. You can color it by Dimension without giving any values to it.