KNOWLEDGE BASE

Showing Any Calculation in Column or Row and Grand Total


Published: 25 Jul 2016
Last Modified Date: 10 Feb 2017

Question

How to show any calculation in Column or Row view and Grand Total field.

Environment

Tableau Desktop 9.0.1

Answer

The following instructions can be reviewed in the attached workbook.
Use a calculation similar to the following to display the percent of total per customer in the view and calculate the percent of total sales for the entire data set in grand totals.
IF SIZE() = 1
THEN <calculation shown in Grand Total field>
ELSE <calculation shown in view>
END

In this example, SIZE() is used to define the number of rows in each partition. In this case, IF SIZE() = 1 is saying that if the partition is 1 (Grand Total is one row) THEN return our calculation we want to show in Grand Total. ELSE (if the partition or rows are anything other than 1) returns our calculation to show in the view.
Did this article resolve the issue?