Last Modified Date: 20 Jul 2023
Environment
Tableau DesktopAnswer
Option 1: Use Nested Level of Detail (LOD) Expressions
The attached example workbook uses the sample data set Superstore to demonstrate the following instructions:- Drag Regions to Rows.
- Drag Measure Names to Columns and Measure Values to Text.
- Select Analysis > Create calculated field
- Name the calculated field "Maximum regional sales (LOD)", enter the following formula and click OK:
{FIXED : MAX( { FIXED [Regions] : SUM( [Sales] ) } ) }
- Add the calculated field to the Rows shelf
- Right click the calculated field on Rows and convert it as Discrete
- Right click the calculated field on Rows and select Format... to remove or customize decimals.
- Select Analysis > Create calculated field
- Name the calculated field "Region with highest sales Filter (LOD)"
- Enter the following formula and click OK:
{ FIXED [Regions] : SUM([Sales]) } = [Maximum regional sales (LOD)]
- Add the calculated field to the Rows shelf
- Select Analysis > Create calculated field
- Name the calculated field "Region with highest sales (LOD)", enter the following formula and click OK:
IF { FIXED [Regions] : SUM( [Sales] ) } = [Maximum regional sales (LOD)] THEN [Regions] END
- Drag [Region with highest sales (LOD)] to the Rows shelf.
Option 2: Use table calculations
The attached example workbook uses the sample data set Superstore to demonstrate the following instructions:- Drag Regions to Rows.
- Drag Measure Names to Columns and Measure Values to Text.
- Select Analysis > Create calculated field
- Name the calculated field "Maximum Sales (table calc)", enter the following formula and click OK:
WINDOW_MAX( SUM( [Sales] ) )
- Add the calculated field to the Rows shelf
- Right click the calculated field on Rows and convert it as Discrete
- Right click the calculated field on Rows and select Format... to remove or customize decimals.
- Select Analysis > Create calculated field
- Name the calculated field "Region with highest sales (table calc)", enter the following formula and click OK:
IF SUM( [Sales] ) = [Maximum Sales (table calc)] THEN MIN( [Regions] ) END
- Drag [Region with highest sales (table calc)] to the Rows shelf.
Additional Information
Notes on Option 2- Table calculations require that all dimensions needed to compute the calculations always be included in the view. In this case, since we want to find the region with the highest sales, [Regions] must be in the view.
To view the above steps in action, see the video below.
Note: the video has no sound.
Thank you for providing your feedback on the effectiveness of the article.
Open new Case
Continue Searching
Knowledge Base
Community
Product Help
Training and Tutorials
Related Links
Results 1-3 of 458