Qlik Community

New to Qlik Sense

Discussion board where members can get started with Qlik Sense.

Announcements
BI & Data Trends 2021. Discover the top 10 trends emerging in today. Join us on Dec. 8th REGISTER
cancel
Showing results for 
Search instead for 
Did you mean: 
Highlighted
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 (2)
0 Replies