7 Replies Latest reply on Feb 13, 2018 9:32 PM by Chris McClellan

# Colorizing Percentiles in a Bar Graph

Hey all,

I'm hoping to get some assistance here as i'm currently struggling colorizing this the way i'd like to.  I have the numbers broken down into percentiles and would like anything .7 and above to be blue, .7-.5 light blue, and then .5-.3 light red, and finally .3-0 red.

The function I was originally using just to see if I could get basic coloring was:

IF SUM([SV%])>.5 then 'blue' Else 'red' end

• ###### 1. Re: Colorizing Percentiles in a Bar Graph

Some sample data would be great to show you how it works

What happens when you put your calculated field on Color ? The syntax is correct if you're showing [SV%], but it looks like that's only the first bar in the graph

You might need to put 2 dimensions on Color to make it work properly.

• ###### 2. Re: Colorizing Percentiles in a Bar Graph

Tyler,

Since you did not give workbook, I use superstore as a sample.

Make a calculated field:

IF SUM([Sales]) / TOTAL(SUM([Sales]))>0.1 THEN 'Blue'

ELSEIF SUM([Sales]) / TOTAL(SUM([Sales]))>0.07 THEN 'Yellow'

ELSEIF SUM([Sales]) / TOTAL(SUM([Sales]))>0.04 THEN 'Brown'

ELSE 'Red'

END

Put it in "Color", you will get it.

Hope it helps,

Michael Ye

• ###### 3. Re: Colorizing Percentiles in a Bar Graph

Chris,

When I drop the calculated field into color it turns the entire graph one color, and even if it recognizes it should be red or blue it's still constantly one color, whether that color is correct or not.

• ###### 4. Re: Colorizing Percentiles in a Bar Graph

Understood, that's why I said you might need 2 dimensions on Color.

• ###### 5. Re: Colorizing Percentiles in a Bar Graph

I had to pivot the data, but check Sheet 3

Sheet 1 - your exact situation

Sheet 2 - same graph with pivotted data

Sheet 3 - what you're trying to achieve I think

• ###### 6. Re: Colorizing Percentiles in a Bar Graph

Chris,

That is exactly what I want to do but it unfortunately won't let me look at your workbook for some reason.

Tyler

• ###### 7. Re: Colorizing Percentiles in a Bar Graph

What version of Tableau are you using ?

I created the workbook using 10.3.2, so I was guessing you were using that or higher.