Skip to main content
Woohoo! Qlik Community has won “Best in Class Community” in the 2024 Khoros Kudos awards!
Announcements
Nov. 20th, Qlik Insider - Lakehouses: Driving the Future of Data & AI - PICK A SESSION
cancel
Showing results for 
Search instead for 
Did you mean: 
Kayl
Contributor
Contributor

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 (1)
0 Replies