KNOWLEDGE BASE

How To Group Different Measures Under A Common Header


Published: 28 Apr 2020
Last Modified Date: 30 Apr 2020

Question

How to group different measures under a common header.
Example: Grouping discount and profit under heading1 and quantity and sales under heading2

Environment

  • Tableau Desktop

Answer

Steps

1. Pivot the required measures into one column (This will result in pivoted field names having all the measure names and pivoted field values having the values for those measures)
2. Create a calculated field with the below formula:
if ([Pivot Field Names]="Discount" OR [Pivot Field Names]="Profit") THEN "heading1" ELSEIF ([Pivot Field Names]="Quantity" OR [Pivot Field Names]="Sales") THEN "heading2" END
3. Drag the above calculated field and pivot field names on Columns shelf and pivot field values to text

The resulting view would look like below:
User-added image
Did this article resolve the issue?