Define a Metric Precisely
Purpose
Produce an unambiguous, versioned metric definition that removes interpretation, so every report, dashboard and team computes the same number and disputes shift from "whose number is right" to "what should we do".
When to use
- Two reports show different values for the "same" metric.
- A new KPI is being introduced to a dashboard, OKR or contract.
- A metrics catalog or semantic layer entry must be written.
When not to use
- The need is choosing which KPIs matter for a goal. Use
kpi-definition.
- The question is data correctness at field level. Use
data-quality-rules.
- A single company-wide guiding metric is being chosen. Use
north-star-metric.
Inputs
Required:
- Metric name and the business question it should answer.
Optional, improves quality:
- Existing formulas or SQL from different teams.
- Source tables and field names.
- Known disputes or examples of mismatched numbers.
If the business question is missing, ask; otherwise mark gaps [TBD].
Process
- Write the purpose: which decision the metric informs and what "good" direction is.
- Define the entity and grain (per customer, per order, per day) and the population in scope.
- Write the formula in plain language and as pseudo-SQL: numerator, denominator, aggregation (count distinct, sum, median).
- Specify filters and exclusions explicitly: test/internal accounts, cancelled or refunded transactions, bots, currencies, tax.
- Specify time logic: event time vs processing time, time zone, period boundaries, rolling vs calendar windows, late-arriving data and restatement policy.
- Enumerate edge cases and their treatment: nulls, zero denominators, reactivations, merges/splits of entities, partial periods, duplicates.
- Map to source fields and the system of record; note lineage and known quality issues.
- If existing definitions conflict, show a reconciliation table (definition A vs B, difference driver, estimated direction of gap) and recommend one.
- Set owner, review cadence, version and effective date; note that historic values must be restated or annotated when the definition changes.
- Add guidance for interpretation: known seasonality, related guardrail metrics, anti-gaming notes.
- Label every inference
[ASSUMPTION] and move unsupported items to open questions. If the user's goal continues, suggest dashboard-spec to visualize the metric or data-quality-rules to guard its inputs.
Output format
# Metric: <name> (v<version>)
| Field | Value |
|---|---|
| Purpose / decision | ... |
| Desired direction | Up / Down / Within band |
| Owner | <name or [UNKNOWN]> |
| Grain / entity | ... |
| Effective from | <date or [TBD]> |
## Definition
Plain language: ...
```sql
-- pseudo-SQL
SELECT ... FROM ... WHERE ... GROUP BY ...
```
## Filters and Exclusions
- ...
## Time Logic
- Time stamp used: ... | Time zone: ... | Window: ... | Late data: ...
## Edge Cases
| Case | Treatment |
|---|---|
## Sources and Lineage
- ...
## Reconciliation (if conflicting definitions exist)
| Aspect | Definition A | Definition B | Effect on number |
|---|---|---|---|
## Interpretation Notes
- Guardrails: ... | Seasonality: ... | Gaming risk: ...
Quality checklist
Common pitfalls
- "Active" without an activity definition. Name the qualifying events and the look-back window.
- Mixing event date and booking date between numerator and denominator.
- Changing a definition silently. Version it and annotate historic charts.
Example
Input: "Define 'active customer'; finance counts paying accounts, product counts users who logged in."
Excerpt of output:
- Purpose: Size of the engaged paying base for retention decisions.
- Definition: Distinct customer accounts with an active paid subscription on the last day of the month AND at least one qualifying product event in the trailing 28 days.
- Reconciliation: Finance count is higher because it includes paying but dormant accounts; product count includes free users.
- Edge case: Accounts merged mid-month count once under the surviving account ID.
1---2name: metric-definition3description: "Defines a business metric precisely enough that two analysts would compute the same number - purpose, formula, numerator/denominator, filters, grain, time logic, edge cases, source fields and owner. Use when a metric is disputed, reported differently across teams, about to be added to a dashboard or OKR, or needs to be documented in a metrics catalog."4license: MIT5metadata:6 source: https://skillmd.com/skills/muratdincer/metric-definition7 version: "1.0.0"8 language: en9 category: 08-data10 role: data-analyst11 area: analytics12 title: "Define a metric precisely"13 related: "kpi-definition, dashboard-spec, north-star-metric, data-quality-rules, glossary-builder"14 prompt: "Define \"active customer\" precisely; finance and product report different numbers every month."15---1617# Define a Metric Precisely1819## Purpose20Produce an unambiguous, versioned metric definition that removes interpretation, so every report, dashboard and team computes the same number and disputes shift from "whose number is right" to "what should we do".2122## When to use23- Two reports show different values for the "same" metric.24- A new KPI is being introduced to a dashboard, OKR or contract.25- A metrics catalog or semantic layer entry must be written.2627## When not to use28- The need is choosing which KPIs matter for a goal. Use `kpi-definition`.29- The question is data correctness at field level. Use `data-quality-rules`.30- A single company-wide guiding metric is being chosen. Use `north-star-metric`.3132## Inputs33Required:34- Metric name and the business question it should answer.3536Optional, improves quality:37- Existing formulas or SQL from different teams.38- Source tables and field names.39- Known disputes or examples of mismatched numbers.4041If the business question is missing, ask; otherwise mark gaps `[TBD]`.4243## Process441. Write the purpose: which decision the metric informs and what "good" direction is.452. Define the entity and grain (per customer, per order, per day) and the population in scope.463. Write the formula in plain language and as pseudo-SQL: numerator, denominator, aggregation (count distinct, sum, median).474. Specify filters and exclusions explicitly: test/internal accounts, cancelled or refunded transactions, bots, currencies, tax.485. Specify time logic: event time vs processing time, time zone, period boundaries, rolling vs calendar windows, late-arriving data and restatement policy.496. Enumerate edge cases and their treatment: nulls, zero denominators, reactivations, merges/splits of entities, partial periods, duplicates.507. Map to source fields and the system of record; note lineage and known quality issues.518. If existing definitions conflict, show a reconciliation table (definition A vs B, difference driver, estimated direction of gap) and recommend one.529. Set owner, review cadence, version and effective date; note that historic values must be restated or annotated when the definition changes.5310. Add guidance for interpretation: known seasonality, related guardrail metrics, anti-gaming notes.5411. Label every inference `[ASSUMPTION]` and move unsupported items to open questions. If the user's goal continues, suggest `dashboard-spec` to visualize the metric or `data-quality-rules` to guard its inputs.5556## Output format57````markdown58# Metric: <name> (v<version>)59| Field | Value |60|---|---|61| Purpose / decision | ... |62| Desired direction | Up / Down / Within band |63| Owner | <name or [UNKNOWN]> |64| Grain / entity | ... |65| Effective from | <date or [TBD]> |6667## Definition68Plain language: ...69```sql70-- pseudo-SQL71SELECT ... FROM ... WHERE ... GROUP BY ...72```7374## Filters and Exclusions75- ...7677## Time Logic78- Time stamp used: ... | Time zone: ... | Window: ... | Late data: ...7980## Edge Cases81| Case | Treatment |82|---|---|8384## Sources and Lineage85- ...8687## Reconciliation (if conflicting definitions exist)88| Aspect | Definition A | Definition B | Effect on number |89|---|---|---|---|9091## Interpretation Notes92- Guardrails: ... | Seasonality: ... | Gaming risk: ...93````9495## Quality checklist96- [ ] Two analysts could implement it independently and get the same number.97- [ ] Numerator and denominator use the same population and time window.98- [ ] Time zone, period boundaries and late-data handling are stated.99- [ ] Every edge case has a stated treatment.100- [ ] Owner and version are set; unknowns are `[TBD]`, not guessed.101- [ ] All checks pass; if any fails, revise the output and re-run this checklist before answering.102103## Common pitfalls104- "Active" without an activity definition. Name the qualifying events and the look-back window.105- Mixing event date and booking date between numerator and denominator.106- Changing a definition silently. Version it and annotate historic charts.107108## Example109Input: "Define 'active customer'; finance counts paying accounts, product counts users who logged in."110111Excerpt of output:112- Purpose: Size of the engaged paying base for retention decisions.113- Definition: Distinct customer accounts with an active paid subscription on the last day of the month AND at least one qualifying product event in the trailing 28 days.114- Reconciliation: Finance count is higher because it includes paying but dormant accounts; product count includes free users.115- Edge case: Accounts merged mid-month count once under the surviving account ID.