Search code examples
amazon-web-servicesdatasetcalculated-columnsamazon-quicksight

AWS QuickSight, How to add new calculated filed which is Sum of column value till the current row


I am new to QuickSight, I want to know how to add a calculated field that will result in giving the sum up until that particular row.

Say I have a donation data set with given below columns.

Name Mode donation
Rahul Cash 100
David Online 150
Adam Cash 200

...

Now I want to add a calculated field (total so far) that should give the total of the donation until that row, as below

Name Mode donation Total so far
Rahul Cash 100 100
David Online 150 250
Adam Cash 200 450

Basically Total so far column is current row donation + the sum of previous donations. I don't want a visual but I want as data set itself, how can I do this.


Solution

  • Use the runningSum function

    If you want to have this sorted by a particular field then that goes at the end in the square brackets, I am using "Name" in ascending order in the following example

    runningSum
    (
      {donation},
      [{Name} ASC]  
    )