Airtable Cobuilder is here! Learn more about our new no-code app creation feature, powered by AI on the Airtable Academy

SUM all orders from a specific ID

1992 2
Showing results for 
Search instead for 
Did you mean: 
5 - Automation Enthusiast
5 - Automation Enthusiast

I have a base of orders that have a customer_id a total cost and a paid column. I would like to know how I can do a formula that would find a customer_id and total all of their outstanding costs. So basically I need to sum total cost for a unique customer_id that has 0 in the paid column.

Anyone has an idea how to do this?

2 Replies 2

Your can just use Groups.

Another option is to summarize the data in another table. This would be especially useful if your customer base is particularly large, and scrolling through grouped transactions may prove tedious.

If you don’t already have a table for your customers, add one. The primary field would be the customer ID, with other fields storing names, addresses, phone numbers, etc.

In your main table of orders, make the {Customer ID} field a link to the [Customers] table. Assuming all the IDs match, it should link up to what’s there, adding a field to [Customers] with links to the [Orders] table.

Back in [Customers], add a couple rollup fields matching the names of your {Total Cost} and {Paid} fields in the [Orders] table. Each would use SUM(values) to rollup the info for the linked orders, with one summarizing the {Total Cost} field, the other summarizing the {Paid} field. To get the difference, add a formula field named something like {Balance Due} to [Customers], containing the formula: {Total Cost} - {Paid}

Now you can see the balance due for all customers at a glance, without the need to scroll through grouped transactions.