KNOWLEDGE BASE

How to Get the Rank by the Cumulative Value of the Rows Instead of by Each Column


Published: 23 May 2023
Last Modified Date: 01 Jun 2023

Question

How to get the rank by the cumulative value of the rows instead of by each column?

 

Environment

  • Tableau Desktop

Answer

Below is an example to calculate the rank based on cumulative sales for each category.

User-added image

1. Add Category to Rows.
2. Add YEAR(Order Date) and SUM(Sales) to Columns.
3.Create a calculated field and name it Total sales per category.
{ EXCLUDE DATEPART('year', [Order Date]) : SUM([Sales]) }
4. Create a calculated field and name it Rank.
RANK(SUM([Total sales per category]))
5. Add Rank to Label.
 
Did this article resolve the issue?