# Need help regarding advanced formula usage

214 2
cancel
Showing results for
Did you mean:
4 - Data Explorer

Hello there,

I am trying to create a formula that calculates the total cost of items based on their quantity and unit price; while also factoring in a discount percentage if applicable. I have tried using nested IF statements; but I am running into some challenges with getting the formula to calculate correctly.

Here's an example of what I am trying to achieve:

Item A; Quantity = 10, Unit Price = \$20, Discount = 10%
Item B; Quantity = 5, Unit Price = \$15, Discount = 0%
I want the formula to calculate the total cost for each item taking into account the quantity, unit price, and discount, and then sum up the total cost for all items.

Could someone please guide me on how to structure this formula correctly?

Also, I have gone through this; https://community.airtable.com/t5/formulas/need-help-with-formula/salesforce/149593 and it definitely helped me out a lot.

Any help or insights would be greatly appreciated.

2 Replies 2
18 - Pluto

Try this:

``````Quantity * Price *
IF(
Discount,
1 - Discount,
1
)``````

18 - Pluto

How are your tables and fields set up?

One way of doing this is to have a two table system. One table for entire orders, and another linked table for line items. Use a formula like Adam’s to calculate the price for each line item. Then use a rollup field to the main orders table to see the sum for the entire order.