Create a 100% Stacked Bar Chart in Tableau

At our company, we reviewed sales reports using Tableau stacked bar charts. This chart shows us the total sales for each category, but bigger categories like Technology always take up most of the space. As a result, it becomes difficult to see how smaller categories or their subcategories are performing.

Along with the total sales numbers, the management also wanted to know the percentage share of each sub-category within its category. For example, instead of just knowing that Chairs made $50,000 in sales, they wanted to see that Chairs contributed 60% of the total Furniture sales.

As a solution for this, we used a 100% stacked bar chart in Tableau. This chart displays every bar at 100%, and the segments within the bar represent the percentage share of each sub-category.

In this Tableau tutorial, I will explain how to create a 100% stacked bar chart in Tableau.

Tableau 100% Stacked Bar Chart

In Tableau, a 100% stacked bar chart is a type of bar chart where each bar represents 100% of a category’s total. The segments or stacks within the bar indicate the percentage contribution of each part to the total. Unlike a standard stacked bar chart that displays actual values, a 100% stacked bar chart focuses on relative shares or proportions.

Create 100% Stacked Bar Chart in Tableau

To create a 100% stacked bar chart in Tableau, we will use the Tableau Superstore dataset. In this stacked bar chart, we will show the sales of categories across regions.

To create a 100% stacked bar chart in Tableau, there are two methods that we will discuss in the points below.

  • Create 100% Stacked bar chart in Tableau using Table Calculation
  • Create 100% Stacked bar chart in Tableau using dual axis

Create 100% Stacked Bar Chart in Tableau Using Table Calculation

Now, connect the tableau to the data source and follow the steps below to create a 100% stacked bar chart in Tableau using table calculation.

  1. For the stacked bar chart, add ‘Sales‘ to Rows, ‘Regions‘ to Columns, and ‘Category‘ to Color card in the Marks section.
100% stacked bar chart in Tableau

This will stack the sales of the category for regions in each bar.

  1. For the measure value, add the Sales(SUM) to the Label card in the Marks.
Create a Stacked Bar Chart with 100%
  1. For 100% stacked bar chart, we need to convert the number into a percentage. For this, click on the Sales label in the Marks and select Format.
Create a 100% stacked bar chart in tableau
  1. In the Format select Pane -> Default -> Numbers -> Percentage. We can also remove the decimals from the percentage by selecting Decimal Places as 0.
Show percentage in Tableau stacked bar chart
  1. Now, the percentage will display the sales figures as a percentage. To get the total percentage, select SUM(Sales) -> Quick Table Calculation -> Percent of Total.
Percent of total in 100% Tableau stacked bar chart
  1. Now, we will have the sales percentage share of each category for the region. To make these percentages 100% for each bar, select SUM(Sales)-> Edit Table Calculation.
Percentage in 100 in Tableau stacked bar chart
  1. In the table calculation, select the Compute Using as Table(down).
Table calculation for 100% stacked bar chart in Tableau

Now, we can see the percentage as 100% for each bar in the Tableau stacked bar chart.

Stacked Bar chart in Tableau with 100%

This way, we can create a 100% stacked bar chart in Tableau, following the above steps.

Create 100% Stacked Bar Chart in Tableau Using Dual Axis

Another method through which we can create a 100% stacked bar chart in Tableau is by using a dual-axis chart.

This method is ideal when you want to show the percentage contribution of a category while also highlighting the remaining part up to 100%.

Follow the steps below to create a 100% stacked bar chart in Tableau, using the dual-axis chart.

  1. Add a segment, such as Sub-category, to the Rows.
Create 100% stacked bar chart in Tableau
  1. Create a calculated field using the formula below. This will calculate the contribution of each sub-category to the total Sales.
SUM([Sales]) / TOTAL(SUM([Sales]))
100% stacked bar chart in Tableau using Dual Axis
  1. Change the format of the calculated field to a percentage. For this, click on the field in the sidebar and select Default Properties -> Number Format. In the format, select “Percentage” and click OK.
Use dual axis for 100% stacked bar chart in Tableau
  1. Now, add the calculated field “% of Sales” to the Columns. Near the calculated field, add one more measure. To do this, click on Columns and write AVG(1). With this, we will see two sets of bars.
Calculate field for 100% stacked bar chart
  1. To create the stacked chart, click on the AVG(1) in the Columns and select Dual Axis.
Tableau 100% Stacked bar chart
  1. With this, a dual-axis chart will be created. Now, change the Marks type to Bar chart for both charts. For this, you can select Bar in All Marks, which will set the mark type to bar in both charts.
Create a stacked Bar chart with 100% Marks in Tableau
  1. To show the 100% stack for each category or the sub-category, assign a different color to both charts.
  1. Now, in Mark’s section of AVG(1), click on the Color card, reduce the color opacity so that ‘% of sales’ is visible on the same bar.
Dual Axis chart for 100% stacked bar chart

This will create the visual as the actual sales percentage stacked with the 100% limit in the bar.

  1. Now to show the percentage up to 100 on the axis, right-click on the ‘% of Sales‘ axis and select Edit Axis.
100% stacked bar chart with measures in Tableau
  1. In the edit axis, select Tick Marks > Range > Custom. In the custom range, select Fixed start as zero and Fixed end as 1.
Axis in 100% stacked bar chart in tableau

This will create a range of percentages from 0 to 100 on the X axis.

  1. At last, sort the categories according to their share in descending order using the sort button in the nav bar. To show the sales % in the bars, add the calculated field “% of Sales” in the Label card.
Custom 100% stacked bar chart in Tableau

This way, we can create a 100% stacked bar chart in Tableau using a calculation field in a dual-axis chart.

Conclusion

In this Tableau tutorial, we have learned how to create a 100% stacked bar chart. In the above examples, we created a 100% stacked bar chart using the table calculation to show the share of sales in each category with 100% bar measure.

In another method, we created a 100% stacked bar chart using the Dual-axis chart. In this, we displayed the sales share of each sub-category as a percentage of the total 100% in the bar.

You may also like to read:

Agentforce in Salesforce

DOWNLOAD FREE AGENTFORCE EBOOK

Start with AgentForce in Salesforce. Create your first agent and deploy to your Salesforce Org.

Salesforce flows complete guide

FREE SALESFORCE FLOW EBOOK

Learn how to work with flows in Salesforce with 5 different real time examples.