3 Replies Latest reply on Mar 17, 2016 2:32 PM by swaroop.gantela

# How do I get the percentage to display on a stacked bar graph?

I have spent the last 3 days following tutorials like these:

But for some reasons, I was unable to follow these tutorials to the end and get the result I am trying to go get.

I have 10 years of data from 2000-2015, each year has 5 categories.  I managed to build a stacked bar graph and show the actual amounts for each subcategory on the graph, but I would like to show the percentage.

For some reason, when I tried the   Quick Calculation-Percent from Total to get the percentage, tableau calculate the total of the whole 10 years rather than just that particular year, I tried the table down,across, cell, and none gives the desired result.

So my workbook (Age Distribution) is attached, and the final product I am trying to get to is the SmartphoneCostBreakDown by Sarah Lewin.

Thank you for any help.

• ###### 1. Re: How do I get the percentage to display on a stacked bar graph?

Quynh,

There is likely a better way to do it,

but I tried using an LOD calculation to sum across the years,

and then divided each age group by that total.

You could also pivot all the years into one column:

Year     AgeGroup     Value

2010   >25                 ......

And then you should be able to use the Percentage of Column function.

1 of 1 people found this helpful
• ###### 2. Re: How do I get the percentage to display on a stacked bar graph?

I did thought about the method you employed in Age distribution2, but I did not know how to do the calculated field correctly.  Now thanks to you, I do.

And I tried to understand what you did in Age distribution3, but I haven't a clue.

Anyways, thank you very much.  I will keep at it.

• ###### 3. Re: How do I get the percentage to display on a stacked bar graph?

Quynh,

I've cleaned up the twbx and attached it here.

Apologies if you've seen this before, and apologies for listing each step, but what I did was:

-go to the Data Source tab,

-ctrl-click to select all the age group columns

-select pivot from the pull-down menu

-renamed the resulting columns to AgeGroup, Values

-put Year (as discrete) on the Columns shelf

-put Values on the Rows shelf

-from top menu, selected "Percentage of > Column"