top of page

How to Add Color to Only One Bar in Tableau Using a Calculated FIeld

How do you add color to only one bar in tableau in this example I have a bar chart of sales by region and I have only East colored green everything else is gray I have two examples my second example will show how you can color only the top bar in this example I have the top bar as orange and everything else blue let's take a look at how to do this in tableau thank you foreign if this is your first time here make sure you like And subscribe for more Tableau content let's start by building our bar chart with region and sales the first example is pretty simple sort of highest to lowest and i've read a calculated field and call call it color one it's gonna be a simple if statement if region equals East then green else right and let's bring color one into the view onto color doesn't default to the red colors defaulted to orange and blue but I can change this to green and gray to gray click apply okay let's edit this formula I'm going to write it a little bit differently because maybe your use case is not as simple as what region is it maybe I want to test what the highest bar is so I want West to be colors colored because it's the highest value so I can rewrite this calculation and test if rank of sum of sales to closing parentheses equals one then green else Gray put an end at the end click apply the level of detail changed so I'm going to drag it back in whenever you see a red pill drag it out and drag a new one back in let's drag color one onto color and I have top value is Orange let's change it to Green bottom values are gray click apply okay and i've colored only one bar in Tableau hope this helps

15 views0 comments
bottom of page