Last Modified Date: 09 Dec 2022
Environment
Tableau DesktopAnswer
The following directions are demonstrated using the sample data set Superstore in the downloadable workbook in the right-hand pane of this article.- 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] ) }
- Drag [Total Profit] to Detail on the Marks card.
- 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
Thank you for providing your feedback on the effectiveness of the article.
Open new Case
Continue Searching
Knowledge Base
Community
Product Help
Training and Tutorials