6 Replies Latest reply on Dec 11, 2018 12:19 PM by Cédric Tran

# Measure Values Diverging Color Palette

Hello Tableau Community,

I am trying to figure out the best way to add a third color to the palette. For example, color in yellow all numbers between 45-55 keeping the existing color palette. Can this be done in a color palette or has to be a calculated field. I am trying to stay away from the calculated field since I have a total of 12 values. I appreciate your help. • ###### 1. Re: Measure Values Diverging Color Palette

Hello,

12 ranges of values are quick to organize in a calculation.

ex:

if sum(value) >0 and sum(value) <12 then 'green'

elseif sum(value) >=12 and sum(value) <20 then 'blue'

[...] end

then associate your color to this dimension.

according to me, there is no other way to do this directly in the color mark of a measure.

cédric

• ###### 2. Re: Measure Values Diverging Color Palette

Hello Cedric,

Thank you for your reply. My apologies I meant to say I have 12 measures. The below code is what I am trying to write. As you can see, I would have to do this through Week 12. I am trying to accomplish any number from 0-45 should have no fill, 45-55 yellow , and greater than 55 red. Thanks again for your help.

if SUM([Week 1]) >=0 and SUM([Week 1]) < 45 then ''

ELSEIF SUM([Week 1]) >=45 and sum([Week 1]) <=55 then 'yellow'

ELSEIF SUM([Week 1]) > 55 then 'Red'

ELSEIF SUM([Week 2]) >=0 and SUM([Week 2]) < 45 then ''

ELSEIF SUM([Week 2]) >=45 and sum([Week 2]) <=55 then 'yellow'

ELSEIF SUM([Week 2]) > 55 then 'Red' END

• ###### 3. Re: Measure Values Diverging Color Palette

Hello,

The calculation has to be done on the measure and not the dimension.

1. create a calculation with your measure: sum(my_measure)

2. take your calculation and create your "color dimension" with conditions like: if [my_measure] > 0 and [my_measure] < 45 then red etc...

3. put your dimension and measure in your viz

4. put your "color dimension" in color and assign the color you like

If I missunderstand something, please put a workbook that illustrate your problem.

Cedric

1 of 1 people found this helpful
• ###### 4. Re: Measure Values Diverging Color Palette

Thank you very much. I able to complete the dashboard using your suggestion.

• ###### 5. Re: Measure Values Diverging Color Palette

Thank you very much. I able to complete the dashboard using your suggestion.

• ###### 6. Re: Measure Values Diverging Color Palette

Great !

Please mark the discussion as solved by me :-)

Cedric