KNOWLEDGE BASE

Display Rank Based on Grand Total in Crosstab


Published: 16 Sep 2022
Last Modified Date: 16 Sep 2022

Issue

How to display Rank based on the Grand Total in a crosstab.

Environment

  • Tableau Desktop

Resolution

Instead of using the total function, we will create a Calculated field that calculates the grand total.

User-added image

1. Connect to the Sample-Superstore datasource.
2. Drag Region to Columns and Sub-Category to Rows.
3. Drag Sales to Text on the Marks card.
4. Create a new calculated field as follows:
     Name : Grand Total
     Calculation : TOTAL(SUM([Sales]))
5. Right-click on Grand Total and select Convert to discrete.
6. Create a new calculated field as follows:
     Name : Rank
     Calculation : RANK([Grand Total])
7. Right-click on Rank and select Convert to discrete.
8. Drag Rank to the far-left position of Rows and Grand Total to the right-most position of Rows.
User-added image
9. Right-click on Rank on Rows and select Edit Table Calculation to set the following:
User-added image
 

Cause

This feature is currently not built in Tableau Desktop.

The Rank calculation fields must be placed on the shelf as discrete. However, if the discrete fields are placed on the shelf, the Total cannot be displayed.
 
Did this article resolve the issue?