Help

Calculating Total Cost from multi-select input

Topic Labels: Base design
Solved
Jump to Solution
3441 3
cancel
Showing results for 
Search instead for 
Did you mean: 
Godel
4 - Data Explorer
4 - Data Explorer

Hi,

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).
Products Airtable

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

The Line Items Table (includes lookup to the Products Table)
Lineitems Airtable
Line Items Lookup Airtable

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!

1 Solution

Accepted Solutions
ScottWorld
18 - Pluto
18 - Pluto

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.

See Solution in Thread

3 Replies 3
ScottWorld
18 - Pluto
18 - Pluto

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.

Godel
4 - Data Explorer
4 - Data Explorer

Very cool @ScottWorld

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

Products Airtable 2

Line Items 2

Orders Airtable 2

Is this more in line with what you were thinking?

Yeah, that looks pretty good!