Adding values from previous rows

Hey Jorge,
not sure if this is the shortest way, but at least it works:

How to do it:

  • Add a unique consecutive Row Id to avoid problems when deleting / editing rows. You need two columns to make this happens, but you can hide them later:
  • Add a new column and choose “Row properties → Row ID”.
  • Add a new column, name it “Real ID” and use this formula:

=Rank([Row ID],thisTable.[Row ID],true )

  • Hide the Row ID and Real ID Columns, if they annoy you
  • Use this Formula in your Total Column:

=if(thisRow.[Real ID]==1,thisRow.value,thisRow.value+thisTable.Filter([Real ID]=thisRow.[Real ID]-1).total)

How it works:
It basically checks if you are currently in the first row.
If yes, it just takes the value of the value column.
If not, it adds the value of the current row to the total of the last row.
To do this, it needs a reference to the last row - thats why we need the Real ID

More about consecutive Row Numbers here:

11 Likes