Qlik Community

New to Qlik Sense

If you’re new to Qlik Sense, start with this Discussion Board and get up-to-speed quickly.

Qlik Insider: SaaS capabilities for Data Integration and Analytics, May 25th! Register Now
Showing results for 
Search instead for 
Did you mean: 

Colour based on expression

I have a bar chart with bars for colours (say RED, AMBER, GREEN), then i have alternative dimensions that allows the user to switch between levels. the volume of each colour will change between levels, so level 1 will have for example 10 RED, 12 AMBER and 1 GREEN. Level 2 will have 5 RED, 15 AMBER and 20 GREEN. There is a field for each level with a value for colour. i have created a measure expression using IF to change the colour of the BAR, but it doesn't apply to all of the 4 Levels.

if([Level0Colour] = 'RED','#ff0000',
if([Level1Colour] = 'RED','#ff0000',
if([Level2Colour] = 'RED','#ff0000',
if([Level3Colour] = 'RED','#ff0000',
if ([Level0Colour] = 'AMBER', '#ffa500',
if ([Level1Colour] = 'AMBER', '#ffa500',
if ([Level2Colour] = 'AMBER', '#ffa500',
if ([Level3Colour] = 'AMBER', '#ffa500',
if ([Level0Colour] = 'GREEN', '#228b22',
if ([Level1Colour] = 'GREEN', '#228b22',
if ([Level2Colour] = 'GREEN', '#228b22',
if ([Level3Colour] = 'GREEN', '#228b22',
lightgray() )))) )))) ))))

Labels (2)
0 Replies