KNOWLEDGE BASE

Filter the View Without Changing Grand Totals


Published: 29 Nov 2016
Last Modified Date: 29 Nov 2016

Issue

How to keep the same grand total when filtering the view. 

Environment

  • Tableau Desktop

Resolution

This example uses Superstore sample data to show the grand total of Sales by State. 
The below solution can be reviewed in the attached workbook. 
  1. Select Analysis > Create Calculated Field
  2. Name the calculation grandtotal.
  3. Enter the following formula, then click OK:
    IF SIZE() = 1 THEN ATTR({FIXED Country : SUM([Sales])})
    ELSE SUM([Sales])
    END 
  4. Place State on Rows 
  5. Place grandtotal on Text
  6. Right-click State and select Show Filter
  7.  Select Analysis > Totals >  Show Column Grand Totals

You can now filter on State, while keeping the grand total the same.

Additional Information

This method can be used to conditionally color the grand totals column as well.
Did this article resolve the issue?