Hi Glide Community,
Is there a way of calculating running totals in the Glide data editor?
I am trying to replicate the below that can be done in Google Sheets but seems to be very difficult in Glide as roll ups are column specific, unless using a relation/lookup/specific array setups.


Is there a way of doing a running total like this? I have tried a different ways with arrays and using the row index but still no luck. Any help would be appreciated!!
Justin
Here are the steps to do it exclusively within Glide.
- Add an index column, use the plugin Array > Find Element Index.
- Add a template column to lock in the format of the number.
- Add a joined list column to join all the “template” numbers.
- Add a JavaScript column to calculate the running total using the list of numbers and the index of each row.
let numbers = p1.split("||");
let total = 0;
for (i = 0; i <= p2; i++) {
total += parseInt(numbers[i]);
}
return total;
Hola!
Here a shorter version of Thinh’s idea by using a helper column as index (which is sequential and you must keep and not change it)

The steps are:
- Create an index column to have a sequence of rows (IDX)
- Create a Joined List based on Qty column
- Type this JS code using IDX column and new Joined List column as parameters
var arr=p1.split("|").map(Number);
var suma =0;
for (i=0; i< p2; i++) {
suma += arr[i];
}
return suma
I hope it helps you.
Saludos!
Thank you both!! You are amazing and certainly saved me from future damage to my head … considering all the banging on the wall I was doing trying to do this completely natively in Glide without JS. 
I am more partial to Thinh’s solution here as having the index calculated via array allows the list to change without other intervention.
It would be amazing if this could be a regular calculation in Glide in future without having to resort to additional JS.
Also to note, thanks Thinh for going above and beyond and actually using the same sheet/numbers I was using! You guys both rock. Hope this thread will help others in future.