Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
Hi,
I have been trying to use the colour by expression feature to set the colours in a bar chart to either Red, Amber or Green depending on the values of the data.
In my source data, I have created a field named 'Internal RAG Rating' which contains values Red, Amber or Green (calculated field based on certain criteria). My bar chart uses the Internal RAG Rating as a measure, and count(Internal RAG rating) as a dimension so I have a simple bar chart with 3 columns showing numbers of Red, Amber and Green data items.
I want to set the colours of the individual bars to match the data type, and I have tried using colour by expression but I am failing miserably to define the expression correctly, even for just 2 colours!
I have tried If([Internal RAG rating] = Red, rgb(255,0,0), (If([Internal RAG rating] = Amber,rgb(255,128,0),rgb(0,255,0)),rgb(0,255,0))
and variations on that, but I keep getting the 'Error in Expression' message, even when I try a simple 2 colour option like If([Internal RAG Rating] = Red,rgb(255,0,0),rgb(0,255,0)) it is ignoring the red data and just returning the default colour.
Can someone more technically gifted than me please advise what I am doing wrong and how to code this expression correctly?
Thanks 🙂
Hi Graham,
sry that I couldn't reply earlier but good to hear that the problem is solved.
Regards,
Ronny