How to display subtotals as percentages

Even though table visualizations are not the best way to understand our data and obtain actionable insights, sometimes we need a bit of detail in our lives, so let’s see how we can make the best of it. Today we’re going to build a table and show the subtotals as percentages by using only one measure. 

Step 1: Connect to data

→ In Tableau Desktop, connect to Global Superstore data provided by Tableau.

Step 2: Create the necessary calculations

Let’s create a calculated field called “Size”: 

SIZE() 

And another one called “Measure for Sales”: 

IF [Size]=1 THEN SUM([Sales] ELSE SUM([Sales]/TOTAL(SUM(Sales)) END 

 Step 3: Build the visualization

By using Category and Sub-Category on rows and the month of Order date on columns, let’s build a table showing the sum of sales on text

Bring “Category” and “Sub-Category” to rows 

Add “Order Date” on columns 

Add “Sales” to Text as a SUM 

 

From the Analysis menu, let’s add the totals and subtotals on top. 

Analysis:  Totals, Show Columns Grand Total 

Analysis:   Totals, Add All Subtotals 

Analysis:   Totals, Column Totals to Top 

 

Bring “Measure for Sales” on Text and since this is basically a nested table calculation, we will need to make sure that both table calculations from here will compute using Category 

 

We can now remove the SUM(Sales) from the visualization and format Measure of sales: 

               Pane: Default numbers as currency 

               Pane: Totals numbers as percent  

               Pane: Grand Totals numbers as currency 

 

We can also change the labelling for Totals so that it changes to “% of Total” 

            Right-click Total, Format Header: Totals label as “% of Total” 

 

Other colour or font formatting may be used to make the table more interesting and there it is, we can now see how much each category contributes as a percent of the total sales! 

Watch the video tutorial here:

 

 

 

About btProvider:

We hold all possible technical and sales certifications for all products:

Tableau Desktop, Tableau Public, Tableau Server, Tableau Prep, and Tableau Data Management.

With Tableau Software – the best data visualization platform – you can always understand your business or your job better. Using Tableau, you will take intelligent and strategic decisions and quickly understand the data flow, numbers and the results it produces. See other #skillpill video tutorials here:

How to display multiple insights on a dashboard in #Tableau

How to create Stacked Bars on Grand Totals in Tableau

How to create a Buffer Zoom in a Tableau Map

Are you interested in learning more about Tableau Software – one of the best analytics tools and implementing the solution in the entire company? 

Contact us!

See how Tableau works, by downloading a free trial here: