John
John

Reputation: 79

Color code only one column in tableau

I would like to color code the last column "difference in ratio", red if less than -10%, green if above 0%. Right now, it color codes the entire the data. How can I limit to only the last column? I attached the link to the file for your review.

Thank you!

https://drive.google.com/file/d/0B1PGq-fzDlKcWEpSdEhQX3VzajA/view?usp=sharing

Upvotes: 4

Views: 58823

Answers (4)

Moises del Real
Moises del Real

Reputation: 51

Using v10.4.2.

I used the "Legends Per Measure" function with a slight tweak.

I started by dragging my "Measure Values" to the "Color" box in the "Marks" area, and selecting "Use Separate Legends" from the right-click menu.

I then dragged another instance of "Measure Values" to the "Label" box in the "Marks" area.

I then created placeholder measure (use something like "=0" or "Min(0)" in the formula)

I dragged the placeholder measure to the "Size" box in the "Marks" area.

I then set all the Marks to "Bar". This is important for getting the background-coloring part to work

This is what your "marked-up" columns should look like, give or take:Final Marks Result

The magic, however, comes from editing your legends. I had three columns, three measures, thus, three legends.

I then selected the drop-down box in the first two legends and created a "Custom Diverging" legend for each one, and set the "Stepped Color" to 2, and then set both colors to white (#ffffff). See screenshot here: Legend Editing Screenshot

And voila: blank backgrounds for the unimportant columns.

This resulted in having no-fill background colors for the cells in the first two columns, and a conditional red-green background range (which I subsequently created) for the values in the third column. Apologies for all the blackout, as the information is confidential, but you should still be able to get the gist of the results: Final Result Screenshot

Hope this is all helpful! Enjoy.

Upvotes: 5

user6713446
user6713446

Reputation:

New in Tableau 10.2 (Feb 2017 onwards) is apparently the ability to apply different colors to different columns (ie Measures), called "Legends Per Measure." I was formerly using some of the tricks mentioned in the answer by Mark Andersen, but this new solution is much cleaner. Using this feature is outlined here:

https://www.ryansleeper.com/tableau-legends-per-measure-conditional-formatting-like-excel/

Essentially it involves dragging Measure Values onto the color shelf, right clicking the new pill created by doing so, and selecting Use Separate Legends.

I hope this helps someone!

Upvotes: 3

minatverma
minatverma

Reputation: 1099

Follow the below steps :

  1. Remove your current calculation from Color Marks.
  2. Press CTRL + Measure Names + Color Flag and drag to Color Marks .It will Look Something as below.

enter image description here

  1. Color code as below , it will scale to whatever you wish because of discrete Color Flag .

enter image description here

Hope this answers. Let me know.

Upvotes: 3

Mark Andersen
Mark Andersen

Reputation: 1028

The tricks you need can be found at: http://public.tableau.com/profile/jonathan.drummey#!/vizhome/conditionalformattingv4/Introduction

There is a very complicated spreadsheet found at that site, but when you download it you would do best to the "Building the Multiple Axis..." tab for the steps to get started. Key points:

  • Add a new measure with value 0.0.
  • Add this measure as a column (I used aggregate min function)
  • Hide the ticks while reformatting the axis to give it the title you desire.
  • Now, you have a distinct set of color/size/etc. configuration per column, so you can do what you want

    There are shortcomings in squeezing through this process, so don't look for Tableau to be Excel.

    Upvotes: 2

  • Related Questions