3 Replies Latest reply on Mar 20, 2013 2:56 PM by Ashley Howard

How do I create a heat map with conditional formatting?

Hi -

I am trying to create a heat map in Tableau. I successfully created one, but I would like to apply ranges to the values. For example, I have data that ranges from 1 - 5. I would like to create a heat map that says if the value is between 1 and 2, the color should be green. If the value is between 2 and 4, the color should be yellow. If between 4 and 5, the color should be red. Do I need to create calculated fields for all of these? If so, can anyone help explain the formulas to me? Thank yoU!

Kate

• 1. Re: How do I create a heat map with conditional formatting?

You just need one calculated field.  Your calculation would look like:

If [Field Name]>=4 AND [Field Name]<=5 then "Red"

Elseif [Field Name]>=2 AND [Field Name]<4 then "Yellow"

Elseif [Field Name]>=1 AND [Field Name]<2 then "Green"

End

Set this calculation on your color shelf.  Edit colors to match.

You can customize your operators and Alias.

-Ashley

1 of 1 people found this helpful
• 2. Re: How do I create a heat map with conditional formatting?

Hi Ashley,

Thanks for your help! That formula worked very well. I have a follow up question for you - is there a way for me to apply the conditional formatting to the average of the [Field Name]? I tried to create a formula but I do not think it will work because the conditional formatting is a Dimension. Would you recommend creating a parameter?

Thanks again,

Kate

• 3. Re: How do I create a heat map with conditional formatting?

What I think you tried to do is avg the dimension.  You want to apply the average inside the calculation by replacing [Field Name] with Avg([Field Name]), so it reads:

If avg([Field Name])>=4 AND avg([Field Name])<=5 then "Red"

Elseif  avg([Field Name])>=2 AND avg([Field Name])<4 then "Yellow"

Elseif avg([Field Name])>=1 AND avg([Field Name])<2 then "Green"

End

1 of 1 people found this helpful