12 Replies Latest reply on Sep 27, 2017 1:51 PM by Jason Alexandre

# How do I color code a bar chart by percent?

I have a dual axis chart I made to show actual amount vs budget amount by region.  I would like to color code the budget amount by percent so: 0-50% of the amount to be one color, 50-75% to be another color and 75-100% a third color (like a stacked bar chart).  I know I can color the background as percents (like a bullet chart) but is there a way for me to color the individual bars?

• ###### 1. Re: How do I color code a bar chart by percent?

friend? here I show the sale VS. budget

• ###### 2. Re: How do I color code a bar chart by percent?

I want it to look like my example but with the budget bars color coded by percent.

• ###### 3. Re: How do I color code a bar chart by percent?

Could you create a simple IF THEN ELSE Calculation for the measure, creating the desired groupings and then drop it on the color marks card?

• ###### 4. Re: How do I color code a bar chart by percent?

I tried this and it gave me an error when I put it on the marks card.  Is there another way for me to calculate the percentages?

• ###### 5. Re: How do I color code a bar chart by percent?

So do you not care about the directionality of your budget variance?  From your sample data, most come in under budget so would present a negative % variance.

• ###### 6. Re: How do I color code a bar chart by percent?

No I just want to section the budget line into three colors (<60% of budget, 60-80% of budget and 80-100% of budget).  The budgets are different per region so the bands will be different.  The actual amount doesn't matter at all.

• ###### 7. Re: How do I color code a bar chart by percent?

I'm thinking you need to create a budget variance calculation

Budget%

(([Amount]-[Budget Amount])/[Budget Amount])*100

And then a recode calculation:

IF ABS([Budget%])>=0 and ABS([Budget%])<=59 THEN 1

ELSEIF ABS([Budget%])>60 and ABS([Budget%]) <= 79 THEN 2

ELSEIF ABS([Budget%]) >=80 THEN 3

END

Then drop the recode calculation on the color marks card and edit the aliases of the legend accordingly or you can just code them within the the actual calculated field.

• ###### 8. Re: How do I color code a bar chart by percent?

Thanks Jason, but I don't want this to be based on the actual amount.  I want 0-0.6*Budget Amount to be one color; 0.6* Budget Amount - 0.8* Budget Amount to be another color; 0.8* Budget Amount - 100% to be a third color.

I am able to do this to the background (the shades of teal) but I want the gray bar to be colored those shades instead.  I'm not sure if this can be done with a calculated field and maybe the percentile function?

• ###### 9. Re: How do I color code a bar chart by percent?

Sorry, I misunderstood.  Can you open a 10.3 packaged workbook? I was able to change it to a bullet chart and set the bands by pane.  You can adjust the color accordingly

• ###### 10. Re: How do I color code a bar chart by percent?

Here's a screenshot - you can edit the reference band to reflect whatever %ages you want.

• ###### 11. Re: How do I color code a bar chart by percent?

I know how to do this but is there a way to get the budget bar, itself to be color coded by percentage?

• ###### 12. Re: How do I color code a bar chart by percent?

I wouldn't think so - the bar is encoding the value, which is a discrete number.  The distribution colors in the background are encoding the bands you want (0-60 is orange, 60-80 is yellow, everything else is in the green).