Custom metrics

Define your own KPI as a formula over period totals.

Updated 9 October 2026Open in Marginful

On this page

A custom metric is a formula you define, for example contribution profit ÷ ad spend. It is computed from the period totals of the selected stores and date range, and can be added to Overview and Dashboards like any other metric. Custom metrics are shared across the workspace.

Open Settings → Metrics → New metric.

Formula syntax

Use + − × ÷, parentheses, numbers and the functions min, max, abs and round. Division by zero shows —.

Profit per unit = net_profit / units

Variables

VariableMeaning
gross_salesGross sales
discountsDiscounts
returnsReturns
net_salesNet sales
taxesTaxes collected
net_revenueNet revenue
shipping_revenueShipping charged
cogsProduct costs, without the RX lens cost
rx_costRX lens cost (Optical pack)
shipping_costShipping costs
handlingHandling fees
feesPayment fees tied to orders
fulfillmentFulfillment costs
packagingPackaging costs
custom_costsOrder-level and variable period custom costs
ad_spendTotal ad spend
ad_revenuePlatform-reported ad revenue
gross_profitGross profit
contribution_profitContribution profit
net_profitNet profit
ordersOrders
unitsUnits sold
new_customersNew customers
daysNumber of days in the period

Format

Choose how the result is shown: currency, percent, number or ratio (×). For a percent, write the formula as a fraction: net_profit / net_revenue shows 13.0% for 0.13.

Deleting a custom metric makes dashboards that use it show —.

Was this page helpful?

Need help?
Custom metrics · Marginful Docs