KNOWLEDGE BASE

Calculating Running Sum in the Specified Order/Rank, Ignoring the Current Sort Order


Published: 30 Nov 2021
Last Modified Date: 30 Nov 2021

Question

How to calculates running sum in the specified order/rank, ignoring the current sort order in the table.

Environment

  • Tableau Desktop

Answer

Using the "Sort Order" option in the table calculation editing window, follow the steps below:
  1. Rank [Sub-Category] by sum of [Profit] like the table displayed on worksheet [Sheet1].
  2. Displays the rank value calculated based on the sum of sales as [SalesRank].
  3. Calculate the running sum of [Profit] in the order of [SalesRank].
    1. Create a calculation field [RunningSumofProfit] RUNNING_SUM(SUM([Profit]))
    2.  Add [RunningSumofProfit] into the view and right click on it > click [Edit Table Calculation.
    3. Select Specific Dimensions and click on the "Sort Order" pulldown list below.
    4. Select "Sales" as aggregation object , "Sum" as aggregation method and "Descend" as sort method.
Note: See the worksheet [Solution] in the sample workbook "RunningSumExample.twbx" attached to this article for more details.
User-added image

 
Did this article resolve the issue?