Announcements
cancel
Showing results for
Did you mean:
Not applicable

## Color by Expression

Hello Folks!

Question. I have a bar chart (see below). I currently have them sorted by the measure of highest % to lowest %. I want the highest % bar (regardless of the percent) to be green then a slow fade to yellow for the mid bar and slow fade to red to the lowest bar. I want them to match the style of my gauge (see below).

Any ideas how to write this expression? Let me know if more information is needed. Thanks!

Theme I want the bars to match ^

Dimensions = [BC]

Measure = Count({\$<[LEVEL 0 COMPLETION]={"Y"},[LEVEL 1 COMPLETION]={"Y"},[LEVEL 3 COMPLETION]={"Y"}>}SID)/Count(SID)

1 Solution

Accepted Solutions
Master

Hi Lauren

use this in your color by mesure panel :

color by expression :

ColorMix2( (rank(total column(1))/(noofrows(TOTAL)/2))-1 ,green(), yellow(),lightred())

Tips : you can set variable for colors so that if you use this color formula in several charts and want to change colors , you just have to change the variable rather than change manually all the color mesures

Hope it helps

4 Replies
Master

Hi Lauren

use this in your color by mesure panel :

color by expression :

ColorMix2( (rank(total column(1))/(noofrows(TOTAL)/2))-1 ,green(), yellow(),lightred())

Tips : you can set variable for colors so that if you use this color formula in several charts and want to change colors , you just have to change the variable rather than change manually all the color mesures

Hope it helps

Not applicable
Author

Hi Bruno! Thanks for the reply! This is what I got below with that expression. I need the yellow in the middle and red at the end. Please advise.

Not applicable
Author

I fixed it!

expression - ColorMix2( (rank(total column(1))/(noofrows(TOTAL)/2))-1 ,green(), lightred(),yellow()) <---- I rearranged the color order - not sure why this works but it works! Thanks!

Master

Hi Lauren