Last Modified Date: 02 Dec 2019
ResolutionUse RANK() instead of INDEX(). The attached example workbook uses the sample data set Superstore to demonstrate the following directions:
- Create a calculated field with a name like "Sort by Rank" with a calculation similar to the following:
RANK( SUM([Number of Records] ))
- Right-click [Sort by Rank] in the data pane and select Convert to Discrete.
- Drag [Sort by Rank] to the Rows shelf just before the last dimension on the Rows shelf.
- By default, Tableau Desktop will compute RANK() by Table (down), which will return the expected sort order, but unexpected ranks.
- To correct the rank values, right-click [Sort by Rank] and select Compute Using > Pane (down).
- Right-click [Sort by Rank] on the Rows shelf and uncheck Show Header.
CauseThe function INDEX() uses the values from the underlying data to compute the index numbers, but underlying values are not filtered by fields from the secondary data source.
Because we specify an aggregated measure inside of RANK(), the RANK() function uses the values as they are computed in the view.
Discuss this article...
Thank you for providing your feedback on the effectiveness of the article.
Open new Case
Training and Tutorials