# Formula to calculate discounts

I have more than one discount in my opportunity line item.

How can I calculate the total in discounts in formula field?

like Unit price =100 Discount1 = 10% Discount2 = 10% Total=81

I found this formula, but work just to one discount:

``````Round({!Unitprice}-{!Unitprice}*{!Discount},2)
``````

Thank you.

• Have you tried any formula yet?
– Sam
Aug 19, 2014 at 14:38

``````Unit_Price__c - ((Unit_Price__c * Discount_One__c) + ((Unit_Price__c - (Unit_Price__c * Discount_One__c)) * Discount_Two__c))
``````

This should work like a math problem. Calculate your first value from the original discount:

``````(Unit_Price__c * Discount_One__c)
``````

and then calculate the value from the second discount by calculating the remaining value from the first discount and multiplying it by the second discount:

``````((Unit_Price__c - (Unit_Price__c * Discount_One__c)) * Discount_Two__c)
``````

Add both of those values together:

``````((Unit_Price__c * Discount_One__c) + ((Unit_Price__c - (Unit_Price__c * Discount_One__c)) * Discount_Two__c))
``````

and subtract all of that from the original unit price.

``````Unit_Price__c - ((Unit_Price__c * Discount_One__c) + ((Unit_Price__c - (Unit_Price__c * Discount_One__c)) * Discount_Two__c))
``````
• I'm sorry is Total Price not Unit price, i'm sorry for the error. But if I insert a new discount, the count is different. TotalPrice - ((TotalPrice * Discount__c)+ ((TotalPrice - (TotalPrice * Discount__c)) * Discount1__c)+ ((TotalPrice - ((TotalPrice -(TotalPrice * Discount__c)) * Discount1__c)) * Discount2__c)) It's rounding problems? This formula have some error? Thank you. Aug 19, 2014 at 16:52
• I'm not sure I follow you. I gave you an example, you will need to take it form there. I didn't realize this needed to work for X amount of discounts. Aug 19, 2014 at 17:24
• Yes, I use your formula and work fine, but with more one discount give me 71,9 instead of 72,9. You think that this formula is incorrect? I appreciate so much your help. Thank you. Aug 20, 2014 at 10:12