KNOWLEDGE BASE

Hide Some Dimension Member Subtotals When There Is Only One


Published: 07 Jul 2017
Last Modified Date: 23 Jun 2021

Issue

 Subtotals cannot be turned on and off automatically for individual dimension members when there is only one record/item.

Environment

  • Tableau Desktop 

Resolution

Workaround 1

  1. Analysis > Totals > Add all subtotals.
  2. Right-click on the sub-header of the category with only 1 row.
  3. Select Hide
User-added image

Workaround 2

Create a sheet swapper toggled by whether there is more than one subtotal in the view.

Follow the steps outlined on this page, but with some minor adjustments:

Create a Sheet Selection Menu for a Dashboard

Adjustments

Do not create a parameter. Instead, create a calculated field to test whether there is more than one subtotal present. Since the subtotals are along a specific dimension, we need to look across all values of that dimension and get the distinct count of values for the dimension:

ATTR( {EXCLUDE [dimensions], [in], [view]: COUNTD([subtotal dimension])} ) > 1

(The [dimensions],[in],[view] should be replaced by the actual names of the dimensions in the view, and the [subtotal dimension] should of course be the dimension along which the subtotals are shown. In the attached sample workbook, that dimension is [Category].)

Duplicate the worksheet and turn off subtotals on the duplicate sheet.

Add the calculated field to the Filters shelf for each, but filter to True on the sheet with subtotals on, and to False on the sheet with subtotals off. (If you cannot get "False" to display in the filter options, first filter the dimension down to only one value.)

Then proceed with placing the sheets on the dashboard as described on the "Sheet Selection Menu" Help page.

Please see the attached workbook for an example implementation.

Cause

The ability to hide subtotals for dimension members when there is only one record is not built in the product.
Did this article resolve the issue?