May
24
2016

Different color coding for each column in Tableau

This article explains how to provide different color schemes to each column in a table in Tableau.

Theory/Information:

There are situations when we want to apply different color coding schemes to each column of a table developed/created in Tableau. This article explains a very simple way to provide different colors in a single table.

When do we require different color schemes in the same table?

Different color schemes may be required in a single table when:

  1. There are multiple measures that are being shown in the table, and the values may give different meanings for different measures
  2. There are multiple measures that are being shown in the table, and each measure has different ranges specified for their values.

Different color coding in a table in Tableau:

Following is a detailed explanation of how to incorporate multiple color schemes in a single Tableau table.

Step 1:

First decide the measures for which color coding needs to be provided and create calculated fields specifying the colors for different values or values ranges.As an example, let us consider the ‘Discount’, ‘Sales’, ‘Quantity’ and ‘Profit’ measures are to be shown at a ‘Region-Category’ level. All data has been obtained from the ‘Sample – Superstore’ dataset.

For the above mentioned 4 metrics/measures, we need to create 4 different calculated fields with the color schemes, as shown below:

4 Metrics

Step 2:

Create a dummy calculated field, say ‘Placeholder’, as shown below.

Placeholder

Step 3:

Now that all the required calculated fields are created, let’s start creating the table.

First, place the required dimensions, here Region and Category, on the Rows shelf. Then place the ‘Placeholder’ calculated field ‘N’ (= number of required measures, here 4) times, on the Columns shelf.

Step 3

Step 4:

Open each of the tab (one for every pill on the Columns shelf) in the Marks shelf and do the following:

  1. Change the Mark type to ‘Text’
  2. Place the required measure on the ‘Label’ shelf
  3. Place the corresponding color calculated field on the ‘Color’ shelf

Step 4

Step 5:

Right-click on the table and select ‘Format’. Click on the icon that looks like a pen. Change ‘Grid Lines’ and ‘Axis Ticks’ drop-downs to ‘None’.

Step 5

Step 6:

Right-click on the axis of each measure and select ‘Edit Axis’ and do the following:

  1. In the ‘General’ tab, change the default title to the name of the measure that is shown in that particular column
  2. In the ‘Tick Marks’ tab, select the ‘None’ radio button for both ‘Major tick marks’ and ‘Minor tick marks’

Step 6_1

Step 6_2

Step 7:

The final touch-up is to be done, before the table is completely ready. Edit the axis height and change the fonts of the axes titles. Also, open the legends and modify them to give appropriate colors for the Color calculated fields.

Step 7

The table with different color coding schemes for each column is ready!!

2tipsAdditional tip:tips

In order to bring the category names to the top of the table, instead of the bottom, place 4 (number of measures displayed in the table) additional ‘Placeholder’ pills on the Columns shelf, each one adjacent to an already existing pill. Then right-click on every second pill and select ‘Dual Axis’. Once the dual-axis chart is created, click on the axes on the top and select ‘Synchronize Axis’.

Follow steps 4 to 7 for the axes on the top. Don’t forget to edit the bottom axes and remove the title.

Additional Step

 

Related Posts

About the Author: Sheeraja Rajakrishnan

I'm Sheeraja, a business analyst from Chennai, India, expertised in developing Tableau based visualizations to aid in business analyses. I am a quick learner and can communicate ideas to others, effectively. I am always ready to learn new technologies and like to share my knowledge with others.

8 Comments+ Add Comment

  • Thanks Sheeraja for sharing it!! I have a question in the "Additional tip" topic. When we duplicate the placeholder and make it as a dual axis, I am getting  sum(sales) text for the first placeholder as well as a circle for the duplicated placeholder. Please let me know how to resolve that?

     

  • I got the answer for the problem.Thanks !!

  • Hi,

    I'm unable to perform below step. How to change Footer to Header Measure Name as you mention above in your explanation..? Please guide through step by step. I got all color coding except footer replacement. 

    Additional tip:

    In order to bring the category names to the top of the table, instead of the bottom, place 4 (number of measures displayed in the table) additional ‘Placeholder’ pills on the Columns shelf, each one adjacent to an already existing pill. Then right-click on every second pill and select ‘Dual Axis’. Once the dual-axis chart is created, click on the axes on the top and select ‘Synchronize Axis’.

    • Hi Venkataram, In order to bring the footer measure name to the header, we need to create a simialr axis on the top, so that we can retain the names on the top and remove the names on the bottom, by editing the axes. In order to do that, each measure name should be made a dual axis, in which case the titles will appear both on the top and the bottom. In order to create the dual axis, just add the SUM(Placeholder) pill next to the existing pills on the columns shelf and combine 2 pills to make dual axes. On doing this, you will be able to see the title both on the top and the bottom. Right-click on the bottom axis, edit the axis and remove the title that is present.

  • This solution is so far i see the best , but for numeric need always alignment right , can it do ?

    • Hi Michelle, Yes, that can be done. If you understand how it actually appears in the center of the column, it'll be very easy to make it appear anywhere else in that column. It appears in the center because the measure that is placed in the columns shelf is SUM(Placeholder), which is actually 0. That means the axis is caliberated to show 0 in the center, because the range that is selected for the axis is 'Automatic'. In order to bring it to the left or the right, what you need to do is: 1. Right-click the axis, edit axis and select Range as Fixed 2. Give it a Fixed start of -1 and a Fixed end of 1 3. Then, modify the 'Placeholder' value to 0.5 (or -0.5, based on left or right) and modify the pill in the Columns shelf to show AVG(Placeholder) instead of SUM If you want to move it further to the right, just modify the value of Placeholder to be 0.75 or 0.8, as required.

  • Hi Sheeraja, really nice article, thanks for sharing.

    I have same kind of problem but instead of tabular I have multiple bars on same axis. Each bar represent separate measure and each measure have their different rule for color coding based on value. So requirement is to apply relevant color rule to relevant bar.

    As I have all measures on one axis, I have only "Measure Values" as Green Pill in column shelf so not sure how to place individual calculation. Can you please help?

    Also if their there is any feasibility of accessing "Measure Values"/"Measure Names" in calculated field. Thanks in advance.

    • Hi Ritesh,

      Place the dimensions that you need in the chart, on the Rows shelf. Instead of placing 'Measure Values' on the Columns shelf, place each measure value separately. For example, if you need to show 2 bar charts with Sales and Profit values, place SUM(Sales) and SUM(Profit) pills on the Columns shelf, next to each other. On the 'Marks' shelf, you'll see separate tabs for the measure values that you place on the Columns shelf. Place the corresponding measure values on the Color shelf. This should give you different colors for different measure values.

      I think this is what you were looking for. If not, please let me know what exactly you are looking for. If you could provide an image, that would make it easy for me to try to get a solution for you.

Leave a comment

You must be logged into post a comment.