12 Replies Latest reply on Apr 5, 2016 8:06 AM by Mahfooj Khan

# Colour coding

Hi I'm a new user and just started on my first assignment. Could anyone help me with colour coding. I have a 5 departments and each department has 4 standard risk categories. The risk categories can have scores between 1 to 16. I have arranged bar charts for each of the 4 risk categories for each of the 5 departments. All the bar charts are blue. I want the scores to be colour coded as follows:

1 to 5 = green

6 to 11 = amber

12 to 16 = red.

How can I do this in Tableau?

Thank you

• ###### 1. Re: Colour coding

Hello Raminder Panesar,

Is there 3 or 4 risk categories? You wrote 4 but displayed 3 (green, amber, red)

The easiest way would be to create a parameter in order to set each categories to these values.

We need to tell Tableau that if a value is between X and X value, it should be with a [color].

You can drag and drop your dimension to Colors and set the parameters from here.

Do you have a workbook (.twbx) to share with me so I can better illustrate what I'm describing?

1 of 1 people found this helpful
• ###### 2. Re: Colour coding

there are multiple methods of handling the ranges in colors such as grouping, parameters (as Lenaic mentioned), if / else calc, so on.  The way I handled is with groups, have a look at the attached.

• ###### 3. Re: Colour coding

Hi Lenaic, thank you. How do I share the workbook?

• ###### 4. Re: Colour coding

Lets assume you've data like this.

Create a calc field for Color KPI. Follow the screenshot.

Feel free to ask if you've any query.

I hope this is what you wanted.

Mahfooj

2 of 2 people found this helpful
• ###### 5. Re: Colour coding

Thank you Jeffrey, I've saved your file into a directory. How do I open it in Tableau?

• ###### 6. Re: Colour coding

Thank you Mahfooj, this is exactly what I wanted. I will try to apply your formulas and let you know.

• ###### 7. Re: Colour coding

Sorry Mahfooj, how did you get the precise red, amber, green colours? My colours are just different shades of green. I entered the formula you gave me into the risk variable pill and dragged it into the color marks card.

• ###### 8. Re: Colour coding

Mahfooj, I think you did it by using a Color KPI. but I don't know how you did that.

• ###### 9. Re: Colour coding

just drag the color KPI calc field on color shelf and manually change the colors. It will work. Try once

• ###### 10. Re: Colour coding

It took me sometime to find out how to create a calculation field and then how to apply it, but it actually worked. Thanks.

• ###### 11. Re: Colour coding

That's great it worked. Many thanks Mahfooj and everyone else who kindly assisted me. I'll have some more basic questions soon !!

• ###### 12. Re: Colour coding

Yeah sure