Exploring Percent of Total on Stacked Bar Charts in Tableau
Mastering Data Visualization: Percent of Total Techniques in Tableau
Enhancing Stacked Bar Charts: Methods for Displaying Percent of Total in Tableau
‘Parts of whole’ or ‘breakdowns of whole’ are widely used concepts in data visualization. Stacked Bar is one such widely used chart in Tableau.
Stacked Bar is one such very widely used chart in Tableau and elsewhere.
Though the police and cops of best practices tend to frown upon developers who use Stacked bar – it is still an extremely popular chart for media companies, finance teams, govt agencies, supply chain and many other industries. In most cases, if not all, Stacked Bar charts are used to represent Percent of Total Contribution.
In most cases, if not all, Stacked Bar charts are used to represent Percent of Total contribution.
Understanding Percent of Total: Importance and Application in Tableau
Method 1: Using Tableau Calculations to Add Percent of Total to Stacked Bar Charts
Method 2: Leveraging Tableau’s Table Calculation Feature for Percent of Total Visualization
Step-by-Step Guide: Implementing Percent of Total Techniques in Your Tableau Visualizations
Exploring the Benefits of Displaying Percent of Total on Stacked Bar Charts
Step-by-Step Tutorial: Adding Percent of Total to Stacked Bar Charts in Tableau
Leveraging Tableau’s Advanced Features: Tips and Tricks for Percent of Total Visualization
Best Practices: Optimizing Stacked Bar Charts with Percent of Total Techniques
Stacked bar can be interpreted in two ways:
a. Branches & Leaves
b. Panes & cells.
The common question is, “Can we represent branch percentages while the percentages are shown for each leaf?” The short answer it – yes, there are multiple ways to do them. We’ve showcase two simple methods (or tricks) below.
Note: For this example, we will be using our favorite Sample-Superstore data from My Tableau repository (utilized with orders table)
Method 1 – Percent of Total on Stacked Bar in Tableau
A step by step approach is written here using the concept of Dual Axis
1) Create a very simple stacked bar. For this example, sales as SUM aggregation on rows for each region on columns with category on the color card.
2) The Sales field is converted into a quick table calculation called “Percent of Total” with the default “Table (across)” scope and direction
(Note: Table Calculations are auto generated functions that incorporate an aggregated measure. They are local to a viz. The ∆ symbol represents a table calc)
3) Use a copy of the existing table calculation on the label card.
4) From the Analytics Pane, use either an Average Line or Reference Line with the following features:
(** At this point – marks shelf splits into multiple components)
5) From the second segment of sales on marks, remove category (this will successfully eliminate stack from the second chart at the bottom)
6) Convert marks to either a bar chart or a Gantt chart.
7) From the second sales segment, use the label card and edit text box. Manage the font size and color. (This is the number that will be represented on top of the Stacked bar)
8) Use the second measure on rows to create a dual axis.
9) Convert the first sales segment under marks to a bar chart
10) Finally synchronize the second axis.
11) Just to improve the viz, hide the header for the second axis.
Method 2 – Percent of Total on Stacked Bar in Tableau
Detailed below is an easy to understand step by step approach written using the concept of reference lines.
1) Create a very simple stacked bar. For this example, sales as SUM aggregation on rows for each region on columns with category on the color card.
2) The sales field is converted into a quick table calculation called “Percent of Total” with the default “Table (across)” scope and direction
(Table Calculations are Auto generated functions that incorporate an aggregated measure. They are local to a Viz. The ∆ symbol represents a Table Calc)
3) Use a copy of the existing Table Calculation on the Label card.
4) From the Analytics Pane, use either an Average Line or Reference Line with the following features:
a) Per Cell (Tableau treats every bar as a cell in this example) with average or sum or min or max or median
b) Custom label (where it can be customized.) This label will be displayed on top of the stacked bar
5) To work on some cosmetics, format the reference line. We can opt to not display the line and can further improve the font – making it a centre aligned label with the required number of formats and decimals.