The Mental Model
Metrics are product APIs for decision-making. A metric definition should be reusable, owned, documented, tested, and safe for many tools to consume.
If an API changes without warning, apps break. If a metric changes without warning, decisions break.
Dataset reference: ecommerce tables and grain assumptions.
Write a metric contract with a counterexample
For this exercise, define order-date net revenue in USD as completed order gross amount minus successful refunds attributed to those orders. Exclude cancelled orders and taxes. This is a teaching definition, not an accounting standard.
Order 101: completed, gross 100, successful refund 20
Order 102: cancelled, gross 50, successful refund 0
Expected net revenue: 80 USD
A cash-flow report that buckets refunds by refund date will have a different daily result. Give that metric a different name rather than silently changing the existing API. Record allowed dimensions, currency handling, owner, refund timing, and version policy with the metric.
Acceptance check: a dashboard and an API consumer return the same 80 for the fixed fixture, and both exclude order 102.
Interactive Check
Question: Why is "revenue" not a complete metric definition?
Reveal the answer
It does not say gross or net, whether refunds are included, which timestamp is used, what grain applies, or which dimensions are allowed.
Practice: Write the net_revenue Metric Spec
Create a beginner-friendly metric card for net revenue.
Use the guided lab below to record your result, assumptions, and the check that would catch an incorrect result.