EnableYourData.com

KPI · E-commerce

Product margin: formula and example.

Product margin is a product's net sales revenue minus its cost, divided by its net sales revenue, as a percentage. It is gross margin at the level of a single item or category. It shows which products carry your profit and which mainly add revenue.

Product margin formula

(Net sales revenue − cost of goods) ÷ net sales revenue × 100%

Worked example

In one quarter, Acme Groothandel sells 300 units of an item at an average net price of €40, €12,000 in total. The cost price is €26 per unit, €7,800 in total. Product margin is (€12,000 − €7,800) ÷ €12,000 × 100% = €4,200 ÷ €12,000 × 100% = 35%.

Fictitious figures for Acme Groothandel, a sample wholesaler.

How to read this KPI

A higher product margin means a product contributes more per euro of revenue. Compare margins between products in the same category and track them over time, because rising purchase prices or extra discounting can quietly erode margin. Look at margin in euros as well as the percentage: a low-margin product with high volume can earn more than a high-margin product that rarely sells.

Pitfalls with product margin

  • Using the list price instead of the price actually paid after discount.
  • Using an outdated purchase price rather than the cost at the time of sale.
  • Confusing margin with markup, which divides profit by cost price instead of selling price.

SQL & DAX

Calculating product margin in SQL and DAX

Two examples on a fictitious data warehouse for Acme Groothandel: a PostgreSQL query and a measure for a Power BI model. Adjust table and column names to your own model.

SQL · PostgreSQL
SELECT p.sku, p.name, p.category,
       SUM(ol.quantity * ol.unit_price - ol.discount_amount) AS revenue,
       SUM(ol.quantity * ol.unit_cost) AS cost,
       ROUND(100.0 * SUM(ol.quantity * (ol.unit_price - ol.unit_cost) - ol.discount_amount)
             / NULLIF(SUM(ol.quantity * ol.unit_price - ol.discount_amount), 0), 1) AS product_margin_pct
FROM order_lines ol
JOIN products p ON p.product_id = ol.product_id
JOIN orders o ON o.order_id = ol.order_id
WHERE o.status <> 'cancelled'
  AND o.order_date >= date_trunc('year', current_date)
GROUP BY p.sku, p.name, p.category
ORDER BY product_margin_pct;
DAX · Power BI
Product Margin % =
VAR Revenue = SUMX(OrderLines, OrderLines[quantity] * OrderLines[unit_price] - OrderLines[discount_amount])
VAR Cost = SUMX(OrderLines, OrderLines[quantity] * OrderLines[unit_cost])
RETURN
    DIVIDE(Revenue - Cost, Revenue)

In ENABLE

Tracking this KPI in ENABLE

Plain-language questions

Ask for product margin per month, customer or product in the SQL Explorer with AI. The AI writes the SQL, you see the query and run it yourself; the AI only receives metadata.

Read more →

In your Power BI dashboard

Define the KPI as a measure in your Power BI model and show it in the portal, with "Last refreshed" next to it. Access profiles and optional row-level security decide who sees which figures.

Read more →

Custom dashboards (pilot)

Add the KPI as a tile to a custom dashboard, compared with last year. The Dashboard Builder is a pilot and can be switched on per client.

Read more →

Monthly targets

With the built-in Targets app you set a target for the KPI per month, so you see actuals and target side by side.

Read more →

FAQ

Frequently asked questions

How do you calculate product margin?

Subtract the cost of goods from net sales revenue and divide the result by net sales revenue. A product sold for €50 that costs €30 has a product margin of €20 ÷ €50 = 40%. Use prices excluding VAT and after discount.

What is the difference between margin and markup?

Margin divides profit by the selling price; markup divides profit by the cost price. With a cost of €30 and a selling price of €50, margin is 40% and markup is 66.7%. Mixing them up can lead you to set prices too low.

What is the difference between product margin and gross margin?

The calculation is the same, but the level differs. Gross margin usually covers the whole business or a whole period; product margin covers one item or category. The revenue-weighted average of all product margins equals your overall gross margin.

Use AI on your own data. Securely, and without the headache.

In an online demo we show how ENABLE makes your data securely available and how you build on it: describing an app in the AI Builder, plain-language questions, dashboards and APIs. And how we set it up and manage it for you.