KNOWLEDGE BASE

How To Calculate RUNNING_SUM in Tableau Prep


Published: 28 Jun 2021
Last Modified Date: 29 Jun 2021

Question

How To Calculate RUNNING_SUM in Tableau Prep

Source data:
User-added image

Output:
User-added image

Environment

  • Tableau Prep Builder

Answer

1. Connect to source data [Sheet 1]

2. Add a Clean Step [Clean 1]

3. Join [Sheet 1] and [Clean 1] with clauses bellow:

[Clean 1].[Order Date] >= [Sheet 1].[Order Date]
[Clean 1].[Category] = [Sheet 1].[Category]

4. Rename [Sheet 1].[Sales] to [RUNNING_SUM(Sales)]

5. Add Aggregate [Aggregate 1] step as bellow:

Grouped Fields: [Clean 1].[Order Date] & [Clean 1].[Category]
Aggregated Fields: SUM ( [RUNNING_SUM(Sales)] )

6. Join [Aggregate 1] and [Clean 1] with clauses below:

[Clean 1].[Order Date] = [Aggregate1].[Order Date]
[Clean 1].[Category] = [Aggregate 1].[Category]

7. Remove the fields that are not needed in the Output.
Did this article resolve the issue?