> ## Documentation Index
> Fetch the complete documentation index at: https://docs.upstackdata.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Contribution Margin: Profit After All Variable Costs

> Track your true marketing profit with Contribution Margin (CM3). Calculate profit after deducting COGS, fulfillment, transaction, marketing, and ad spend.

<Tip>
  Total contribution margin (CM3) after deducting all variable costs including COGS, fulfillment, transaction fees, and marketing/ad spend from net revenue.
</Tip>

## Formula

<Info>
  **Contribution Margin** = **CM2** − **Marketing Cost** − **Ad Spend** − **Agency Fees**
</Info>

### Formula Components

| Metric                                                                             | Definition                                                                       |
| ---------------------------------------------------------------------------------- | -------------------------------------------------------------------------------- |
| **CM2**                                                                            | Margin after deducting COGS, fulfillment, and transaction costs from net revenue |
| [**Marketing Cost**](/reference/metrics/orders/contribution-margin/marketing-cost) | User-defined marketing costs allocated per order                                 |
| [**Ad Spend**](/reference/metrics/advertising/blended/blended-spend/blended-spend) | Total advertising spend across all connected platforms                           |
| **Agency Fees**                                                                    | User-defined agency fees allocated per order                                     |

| Metadata        |                                                                      |
| --------------- | -------------------------------------------------------------------- |
| **Type**        | Currency                                                             |
| **Data Source** | [Shopify](/sources/shopify), [Upstack Costs](/sources/upstack-costs) |
| **Aggregation** | Sum                                                                  |

***

## Example

Your store generated **\$125,000** in net revenue last month. After all variable costs:

| Line Item                   | Amount    | Running Margin     |
| --------------------------- | --------- | ------------------ |
| Net Revenue                 | \$125,000 | \$125,000          |
| − COGS                      | \$37,500  | \$87,500 (CM1)     |
| − Fulfillment + Transaction | \$12,500  | \$75,000 (CM2)     |
| − Marketing Cost            | \$8,000   | \$67,000           |
| − Ad Spend                  | \$15,000  | \$52,000           |
| − Agency Fees               | \$2,000   | **\$50,000 (CM3)** |

Your Contribution Margin is **\$50,000**, representing 40% of net revenue.

***

## How It Works

Contribution Margin (CM3) represents profit remaining after subtracting all variable costs from net revenue. It's calculated as a layered waterfall: Net Revenue → CM1 (minus COGS) → CM2 (minus fulfillment and transaction costs) → CM3 (minus marketing, ad spend, and agency fees). This metric shows true marketing profitability before fixed operating expenses.

***

## When to Use

| Scenario                | Action                                                    |
| ----------------------- | --------------------------------------------------------- |
| Measuring marketing ROI | Compare contribution margin to total marketing investment |
| Setting ad budgets      | Ensure campaigns maintain positive CM3                    |
| Pricing decisions       | Verify products cover all variable costs                  |
| Profitability analysis  | Identify which channels generate real profit              |

***

## Related Metrics

| Metric                                                                         | Relationship                          |
| ------------------------------------------------------------------------------ | ------------------------------------- |
| [Gross Profit](/reference/metrics/orders/contribution-margin/gross-profit)     | Net Revenue minus COGS (CM1)          |
| [Marketing Cost](/reference/metrics/orders/contribution-margin/marketing-cost) | User-defined marketing cost component |
| [Total Cost](/reference/metrics/orders/contribution-margin/total-cost)         | Sum of all cost components            |
| [Net Revenue](/reference/metrics/orders/revenue/net-revenue)                   | Starting point before deductions      |

[See all Contribution Margin metrics →](/reference/metrics/orders/contribution-margin)
