ZenMasta
ZenMasta

Reputation: 31

How do I conditionally change column colors in tableau?

In Tableau, I have a column indicating positive or negative profit. If it's above 0 -- I want the column color green, If it's below 0, I want the column color red.

Upvotes: 2

Views: 8614

Answers (2)

Potatojaisiladki
Potatojaisiladki

Reputation: 87

1.First create a new calculated field say "Profit/Loss" and set the condition something like:


IF ([Profit]))< 0 THEN "Loss" ELSE "Profit" END


  1. Keep the Datatype as 'string' and convert this to Dimension.
  2. Now drag your "Profit/Loss" field to "color" option on the Marks card and then edit the colors as per your requirement.

*Later on you can hide this column from you visualization.

Upvotes: 0

Ben P
Ben P

Reputation: 3369

  1. Drag Measure Values to Colour
    1. Click the colour filter card and choose 'Edit colours'
    2. Choose the colour theme you'd like (in your case, red/green diverging), tick 'stepped colour' and set to '2' steps.
    3. Click 'Advanced' and set your 'Center' to '0'.

This will apply to the whole chart, if you want to apply this to one column only, you need to right click on the colour 'Measure Values' pill and select 'Use Separate Legends'.

Upvotes: 2

Related Questions