Hi. I find it helps to think of this as similar to updating the number of available stock-items after an order.
I have a ‘claims’ table where each record is a tutor claim - per student. Each claim contains a ‘number of hours claimed’ field. I then have an update record automation which passes that value to a ‘hours last session’ field in my ‘student’ table.
Now, in my ‘student’ table I need a new automation to run each time my ‘hours last session’ field is updated, to take that value and add it to a ‘total hours used’ field, Essentially, a running total.
It seems simple but I just can’t seem to find a way of doing this!
Any help would be very much appreciated! Thank you.
Airtable does not handle running totals well natively. This is in part because each record has no idea which record is the “next” or “previous” record.
When people try to do running totals with only linking, formulas, and rollups, they tend to run into problems with circular logic errors. You also need to be careful when designing a system that uses a single automation run for each record in the running total because you need to trigger it correctly and can burn through many automation runs if the system is setup incorrectly.
If your running total is in a single table, you may find this example script useful.
However, it sounds like your running total is spread across two tables, so you might need a different setup.
You may want to think about why you need the running total. Running totals are common in spreadsheets, but less common in databases like Airtable.
You may try to create a table when you link all all records to a single record in the new table and then perhaps add a roll up and a condition for the roll up. That will show a total. I don’t know if it would work, just suggesting to try. But as @Kuovonne would attest, it’s not a good idea to do this setup as it slows down the database and automations a bit.