---
schema_version: "1"
id: 1476a9afc05bf73a59ec86ce5cf08ccb0ca3d6df454058b1c44d515e849e6067
title: Define and Validate Margin Ranges
collection: admin
version: current
locale: en-us
portal_url: https://docs.salesforce.com/admin/current/en-us/ind/264-0-0/comms_define_and_validate_margin_ranges.md
canonical_url: https://help.salesforce.com/s/articleView?id=ind.comms_define_and_validate_margin_ranges.htm&release=264.0.0&type=5
source_site: help.salesforce.com
content_type: documentation
content_hash: 436a65d3636c20281df060163def75031e81c28ef7383fec53a8f0f64512c12c
description: You can define margin ranges using the pricing plan so that the cost does not exceed the price. This is optional. If you do not set up a validation process, users aren't notified when a margin range has been violated.
products:
  - Communications
  - Media
  - Energy and Utilities
release: "264"
---
# Define and Validate Margin Ranges

You can define margin ranges using the pricing plan so that the cost does not exceed the price. This is optional. If you do not set up a validation process, users aren't notified when a margin range has been violated.

![Tip](https://sf-zdocs-cdn-prod.zoominsoftware.com/tdta-ind-comms_media_energy_managed-264-0-0-production-enus/ff4079f6-a384-475c-b863-578bbbb0ef9b/images/icon_tip.png)

Tip

The Default Pricing Plan includes a step to calculate margins after you complete the setup described in this section. See [Default Pricing Plan in EPC](https://help.salesforce.com/s/articleView?id=ind.comms_default_pricing_plan_in_epc.htm&release=264.0.0&type=5 "Salesforce provides a default pricing plan with nine steps. You can rearrange the steps and add new steps to provide additional logic to your pricing plan.").

Margins for each line item can be validated using a LoadMarginRange step in your pricing plan. The LoadMarginRange step invokes a calculation procedure and matrix. This is similar to how attribute-based pricing is implemented using pricing plans.

In general, margins are calculated using the following formula: = ((priceTotal - costTotal) / costTotal) \* 100

For example, ((oneTimePriceTotal - oneTimeCostTotal) / oneTimeCostTotal) \* 100 gives you the oneTimeMargin. See [Formulas for Margins, Recurring Margins, and Usage Margins](https://help.salesforce.com/s/articleView?id=ind.comms_formulas_for_margins__recurring_margins__and_usage_margins.htm&release=264.0.0&type=5 "Use the following formulas to calculate margins, recurring margins, and margin totals for line items in the Industries CPQ Cart.").

Follow these steps to define a margin range and validate the range.

1. [Create an Omnistudio Data Mapper](https://help.salesforce.com/s/articleView?id=ind.comms_create_a_dataraptor_for_cost_and_margin.htm&release=264.0.0&type=5 "You must create a Data Mapper before you can use Data Mapper as a data source to identify and extract the order item (Order Product) or the line item. As an example, you can use the product code and quantity.")
2. [Create a Calculation Matrix](https://help.salesforce.com/s/articleView?id=ind.comms_create_a_calculation_matrix_for_cost_and_margin.htm&release=264.0.0&type=5 "After you have identified the product to which you want to associate a margin range, create a calculation matrix. Specify the input data and make it a unique record (unique row). Identify and specify the lower and upper bounds of the margin range. Set up margin ranges using calculation procedures. Define margin ranges in the Calculation Matrix.")
3. [Create a Calculation Procedure](https://help.salesforce.com/s/articleView?id=ind.comms_creating_a_calculation_procedure_for_cost_and_margin.htm&release=264.0.0&type=5 "The calculation procedure calls the associated calculation matrix to find the margin range for the product and then returns the output from the matrix to the pricing service. If a line item in the cart is outside the upper and lower bounds of the margin range, the Industries CPQ Cart reports an error to the user. For example, if you defined a margin range that cannot be lower than 5%, the Industries CPQ Cart shows an error if the range is 4% for that line item.")
4. [Add Parameters to the Pricing Plan](https://help.salesforce.com/s/articleView?id=ind.comms_add_parameters_to_the_pricing_plan_for_cost_and_margin.htm&release=264.0.0&type=5 "In the Product Console, edit the pricing plan that you want to use to validate the margin ranges. Next, edit the Load Margin Ranges step and add only one of the following parameters you want in the General Properties section.")
5. After you have created the margin range validation process steps, go to the Industries CPQ Cart and add products. If the margin range is violated for the products in your cart, you will see an error message. You will not be able to submit the opportunity, quote, or order until you resolve the error.

- **[Formulas for Margins, Recurring Margins, and Usage Margins](https://help.salesforce.com/s/articleView?id=ind.comms_formulas_for_margins__recurring_margins__and_usage_margins.htm&release=264.0.0&type=5)**  
    Use the following formulas to calculate margins, recurring margins, and margin totals for line items in the Industries CPQ Cart.
- **[Create a Omnistudio Data Mapper for Cost and Margin](https://help.salesforce.com/s/articleView?id=ind.comms_create_a_dataraptor_for_cost_and_margin.htm&release=264.0.0&type=5)**  
    You must create a Data Mapper before you can use Data Mapper as a data source to identify and extract the order item (Order Product) or the line item. As an example, you can use the product code and quantity.
- **[Create a Calculation Matrix for Cost and Margin](https://help.salesforce.com/s/articleView?id=ind.comms_create_a_calculation_matrix_for_cost_and_margin.htm&release=264.0.0&type=5)**  
    After you have identified the product to which you want to associate a margin range, create a calculation matrix. Specify the input data and make it a unique record (unique row). Identify and specify the lower and upper bounds of the margin range. Set up margin ranges using calculation procedures. Define margin ranges in the Calculation Matrix.
- **[Creating a Calculation Procedure for Cost and Margin](https://help.salesforce.com/s/articleView?id=ind.comms_creating_a_calculation_procedure_for_cost_and_margin.htm&release=264.0.0&type=5)**  
    The calculation procedure calls the associated calculation matrix to find the margin range for the product and then returns the output from the matrix to the pricing service. If a line item in the cart is outside the upper and lower bounds of the margin range, the Industries CPQ Cart reports an error to the user. For example, if you defined a margin range that cannot be lower than 5%, the Industries CPQ Cart shows an error if the range is 4% for that line item.
- **[Add Parameters to the Pricing Plan for Cost and Margin](https://help.salesforce.com/s/articleView?id=ind.comms_add_parameters_to_the_pricing_plan_for_cost_and_margin.htm&release=264.0.0&type=5)**  
    In the Product Console, edit the pricing plan that you want to use to validate the margin ranges. Next, edit the Load Margin Ranges step and add only one of the following parameters you want in the General Properties section.
- **[Pricing Variables for Cost and Margins](https://help.salesforce.com/s/articleView?id=ind.comms_pricing_variables_for_cost_and_margins.htm&release=264.0.0&type=5)**  
    Pricing variables are available out-of-the-box. This is required to create a calculation procedure for cost and margin and is part of defining and validating margin ranges.