When constructing standard tables within Tableau, incorporating totals and subtotals into the display can occasionally be a challenge. To address this, we can seamlessly integrate these totals and subtotals into our table by leveraging the drag-and-drop functions provided within the Analytics pane of Tableau. Let's explore into the process of adding both totals and subtotals to our table view.
First, let us create a table, showing the sales of subcategories across different years. We are using Sample Superstore dataset for this demonstration.
Drag 'Category' and 'Sub-category' in rows. Drag 'Order Date' into the column and select 'Years'. Drag 'Sales' into the 'Text' section of the marks card. We will have the table representing sales in categories and subcategories across years as shown in the screenshot below.
Let's consider some scenarios to add total or subtotals in the table view.
Include subtotals for each category in the view
Select 'Analytic' in the left pane (right to 'Data' Pane). Under the 'Summarize' category select 'Totals' and drag it into the view and drop it on 'Subtotals' as shown in the figure below.
As a result, a subtotal for each category is added below the category in the table as shown in the screenshot below.
Incorporate total sales figures spanning across years for both Categories and Sub-categories.
Select 'Analytic' in the left pane (right to 'Data' Pane). Under the 'Summarize' category select 'Totals' and drag it into the view and drop it on 'Row Grand Totals' as shown in the figure below.
As a result, a total for each category and subcategory is added on the right side of the table as shown in the screenshot below.
Alternative
Alternatively, we can achieve the same outcome by navigating to the 'Analysis' menu located in the menu bar. Within this menu, choose the 'Total' option. You'll find various choices including 'Display Row Grand Total', 'Display Column Grand Total', 'Place Row Total on Left', 'Place Column Total on Top'. Additionally, you have the flexibility to aggregate the total value with functions like 'Sum', 'Average', 'Maximum', and 'Minimum'.