-
Create a total cost field on the opportunity record that is a currency field.
-
Add a product cost field to your products.
-
Rollup your Opportunities Line Items, and reference the source field for the related product's cost to get the total product cost across all line items.
-
Then create a formula field that calculates margin between selling pricing and product cost.