← IndexEntry № 225·data

Write a Precise, Unambiguous Metric Definition

Produces a precise metric definition with formula, grain, inclusion rules, and resolved edge cases.

Optimized for
ChatGPTClaude
§ When to use this

Half of all 'the dashboards disagree' fire drills trace back to a metric nobody defined precisely. Is an active user someone who logged in, or who took an action? Does the time window reset at midnight UTC or in the user's zone? Do trial accounts count? This prompt forces every one of those choices into the open and writes them down, turning a fuzzy noun into something two teams can implement identically. The structure, plain definition, exact formula, grain, inclusion and exclusion rules, slice-able dimensions, and resolved edge cases, mirrors how strong analytics teams document metrics so the number means the same thing in finance, product, and the board deck. The SQL-pseudocode sketch at the end bridges definition to implementation without pretending to be production code. Use it whenever a metric is about to appear in more than one place, when two reports already disagree, or when onboarding someone who keeps asking 'wait, how is that calculated?'

§ The Prompt— fill in the fields, then copy or open in a tool
§ Customize0/3 fields filled
your prompt — fill the fields above
You are an analytics lead who hates ambiguous metrics. Help me write a rock-solid definition for the metric [METRIC NAME]. Context: [BUSINESS CONTEXT]. Available data: [DATA SOURCES AND TABLES].

Produce: (1) a one-sentence plain definition, (2) the exact numerator and denominator or formula, (3) the grain and time window (per user, per day, rolling 7 days, etc.), (4) explicit inclusion and exclusion rules (test accounts, refunds, bots, NULLs), (5) which dimensions it can be sliced by, and (6) two edge cases where naive definitions disagree and how this one resolves them. End with a one-line SQL-pseudocode sketch of the calculation. Flag anything I still need to decide before this metric can ship.
Open with your prompt →ChatGPTClaudeSends your filled-in prompt straight into a new chat.
§ Example Output

What you can expect back

Definition: MAU is the count of distinct accounts that performed at least one qualifying action in a calendar month.

Formula: COUNT(DISTINCT user_id) where the event is a qualifying action within the month. No denominator; it is a count.

Grain and window: one number per calendar month, in UTC.

Inclusion/exclusion: include only accounts.type = 'customer'; exclude internal/test accounts and bot user_ids; a passive login with no further action does NOT qualify; drop events with NULL user_id.

Slice by: plan, country, signup cohort, platform.

Edge cases: (1) a user active on the last day of one month and first of the next counts in both months, by design, since the window is per calendar month. (2) A user who only opens an email is excluded because that is not a qualifying in-product action.

Sketch: SELECT date_trunc('month', ts) AS m, COUNT(DISTINCT user_id) FROM events JOIN accounts ... WHERE event_name IN (<qualifying list>) AND account.type='customer' GROUP BY 1;

Still to decide: which exact event_names count as 'qualifying', and whether to use UTC or account-local time.

Illustrative example — your results will vary by tool and inputs.

§ Pro Tips

Get sharper results

  • 01Force a yes/no on every exclusion, test accounts, bots, refunds, NULLs, vagueness here is where two dashboards diverge.
  • 02Name the time zone explicitly; UTC versus local quietly shifts daily and monthly counts.
  • 03List the 'qualifying action' events by name, 'active' is meaningless until you enumerate what counts.
  • 04Keep the edge-case section, it is the documentation future-you will thank present-you for.
§ Variations

Adapt it for your case

Reconcile two definitions

Paste the two conflicting formulas and ask it to find exactly which rule causes the gap.

Metric tree

Ask how this metric decomposes into inputs so you can build a driver tree for diagnosis.

Certification doc

Request a short markdown spec ready to paste into your data catalog or dbt docs.

Use For — Tasks
Tags#metrics#definitions#analytics
§ FAQ

Common questions

Why is the time zone such a big deal?

Defining a 'day' or 'month' in UTC versus user-local time shifts which events fall in which bucket, changing counts and especially day-boundary comparisons.

Can the model just decide the exclusions for me?

It proposes sensible defaults, but inclusion rules are business decisions; the prompt surfaces them as 'still to decide' so a human signs off.

Why include SQL pseudocode and not real SQL?

The sketch shows the calculation's shape without binding you to a dialect or exact column names, which you finalize once the definition is approved.

§ Related Entries

You may also need