KNOWLEDGE BASE

Adding Totals to a Title


Published: 05 Jun 2017
Last Modified Date: 15 Feb 2021

Question

How to add totals to a title.

Environment

Tableau Desktop 

Answer

The following directions are demonstrated using the sample data set Superstore in the downloadable workbook in the right-hand pane of this article.
  1. Create a calculated field that will repeat the total value for every partition in the view. This can be done many different ways. This example will use the level of detail (LOD) expression EXCLUDE, in the field named Total Profit

    { EXCLUDE [Category], [Sub-Category] : SUM( [Profit] ) }

  2. Drag [Total Profit] to Detail on the Marks card.
  3. Add this calculated field to the title. Use the Insert menu to add dynamic text such as sheet properties and field values. See Format Titles, Captions, Tooltips, and Legends for more information.

Additional Information

  • To show the Column Grand Total in the title, list all dimensions included on the Rows shelf, or on Color, Size, Label, or Detail on the Marks card, after EXCLUDE. This will give you the same value as if all of the listed dimensions were removed from the view (aka excluded), which should be the grand total.
  • If the view has more than one grand total (e.g. [Region] was added to the Columns shelf meaning there is a grand total for each of 4 regions), then the title will display the range of total values. To show one of totals, add an IF THEN statement inside of the SUM(), like: { EXCLUDE [Category], [Sub-Category] : SUM(IF [Region] = 'East' THEN [Profit] END) }
  • [Total Profit] should be continuous on the Detail on the marks card.
  • To format how the total looks in the title, set the default formatting for [Total Profit]. See Set the default number format for a field
  • The workbook also includes an example using table calculations. The TOTAL() function mimics the automatic grand total whereas the WINDOW_SUM() function mimics the grand total using SUM. If the table calculation is not returning the expected number it is likely due to how the calculation is computed. See Transform Values with Table Calculations for more information on how to customize table calculations.
 
 
Discuss this article... Feedback Forum
Did this article resolve the issue?