Calculating Total Cost from multi-select input


I am trying to build a formula to properly calculate the cost for an order whose input is a multi-select field of products.

I did my best to follow these recommendations:

The tables are Products, Orders, and Line Items.
Tables for Cost Calculation Airtable

The Products Table (includes lookup to the Line Items Table).

The Orders Table (includes lookup to a Companies Table (not pictured))

The Line Items Table (includes lookup to the Products Table)

I don’t know how to create the field for Total Cost in the Line Items Table to be able to calculate total cost dependent upon which products are linked. On the front end a user would select which products they wish to include in their order.

Any pointers or reference to existing community content would be appreciated. Thanks!

Welcome to the community, @Godel!

Are you saying that you just want to add up those unit costs to give you a total cost? You would just need to create a rollup field called “Total Cost”, have it point to the Products table (because Products is your linked record field), then choose the Unit Cost field, and then type the formula: SUM(values)

That would be the way to do it based on your current setup, although a likely better setup would be to have each record in your line items table include one product instead of multiple products. Then, your rollup field would be back in your orders table.

Very cool @ScottWorld

I think I’m in better shape than I was before.

Is this more in line with what you were thinking?

Yeah, that looks pretty good!

This topic was solved and automatically closed 3 days after the last reply. New replies are no longer allowed.