Ratio Metric

A ratio metric is one whose value is a quotient: conversion rate, gross margin percentage, error rate, click-through rate. It has two parts, and metric specifications treat that as structural โ€” dbt lists ratio as one of its metric types (“conversion, cumulative, derived, ratio, or simple“) and ratio metrics “involve a numerator metric and a denominator metric.”

The reason to treat it as a distinct kind, rather than as a number like any other, is that it does not aggregate. Counts over disjoint populations can be added; ratios require their own aggregation rule.

The average of averages

Take two days. Monday: 50 converting sessions out of 1,000 sessions, a rate of 5%. Tuesday: 20 converting sessions out of 100 sessions, a rate of 20%. Averaging the two daily rates gives 12.5%. Dividing the totals gives 70 converting sessions out of 1,100 sessions โ€” about 6.4%.

Both calculations are arithmetically correct. The 12.5% is the average daily rate, giving the 100-session day the same weight as the 1,000-session day. The 6.4% is the conversion rate across all sessions in the period. Use the latter for the share of sessions that converted; use the former only when the intended quantity is an equally weighted average across days. Neither is automatically a rate over unique people.

The gap depends on the relationship between group sizes and group rates, not on uneven denominators alone. If both days convert at 10%, their simple average and pooled rate are both 10% however different their traffic. Changing traffic can expose a weighting mistake, but does not determine its size or direction.

Store the parts, divide at the end

The rule that prevents it: keep the numerator and the denominator as the stored, transported quantities, and compute the quotient at the moment of display, at whatever grouping is being shown.

That rule carries a condition worth stating, because it is where it breaks. Summing the components and dividing is correct only when both components are additive over the dimension you are combining. They are when both are plain counts or sums. They are not when either side counts distinct things: two users who both visit Monday and Tuesday, a different one buying each day, give 1/2 and 1/2 by day, which summed and divided reads 2/4 = 50% โ€” while the period rate over unique users is 2/2 = 100%. For distinct components, re-derive over the whole period or carry a state that supports union; for balances, fix a point-in-time rule.

This is what declaring a ratio metric as two component metrics accomplishes โ€” the engine re-derives the ratio at the requested grain instead of aggregating a pre-computed rate. Correct rollups still require the underlying components or suitable mergeable state; a table containing only segment rates is insufficient.

The general property behind this is worth knowing by name, because it applies beyond ratios: some measures survive summation across dimensions and some do not. The two that break are the semi-additive fact โ€” an account balance adds across accounts but not across time โ€” and the non-additive fact, of which a ratio is the everyday example.

Choosing the denominator is the hard part

Choose the counted unit, population, and observation window for both parts of the ratio. A session conversion rate counts converting sessions; a user conversion rate counts distinct converting users. Changing only the denominator can create a different quantity, such as purchases per user.

Numerator / denominatorThe question it answers
Converting sessions / all eligible sessions in the windowWhat share of sessions converted, including those that never reached the product?
Checkout-reaching sessions that converted / checkout-reaching sessionsWhat share of sessions reaching checkout converted under the agreed conversion window?
Distinct converting users / distinct users in the defined period populationWhat share of users converted, regardless of repeated visits or purchases?
Distinct converting eligible users / distinct eligible usersWhat share of the eligible population converted, with the same eligibility rules on both sides?

Suppose user A visits twice and converts in both sessions, while user B visits once without converting. Session conversion is 2/3; user conversion is 1/2. Two conversion events divided by two users is one event per user, not a 100% user conversion rate. Record both components, exclusions, attribution window, and the zero-denominator policy in the metric definition. In dbt, metric filters express the inclusion rules used during computation.

A related trap: changing the denominator’s population changes the metric even when the formula is untouched. Excluding a newly blocked region can raise, lower, or leave the value unchanged. Announce the population change so any movement is not automatically read as changed performance.

Interpreting small denominators

A ratio computed on few observations swings wildly, and slicing a dashboard finely produces exactly that. Two conversions out of four is 50%, and the segment that tops the leaderboard is often the one with eight visitors.

Show the numerator and denominator alongside the rate, with an uncertainty estimate appropriate to the sampling design when useful. A minimum base for suppression is one reporting policy; an uncertainty flag or restricted comparison may serve another use better. Choose the policy for the metric and decision rather than treating one cutoff as universal.

Reporting the components alongside the ratio also answers a question the ratio alone cannot: whether a rate moved because the numerator rose or because the denominator fell. Conversion rate improving while both conversions and sessions decline is a different business event from the same rate improving on flat traffic. The business assessment also depends on revenue, cost, traffic quality, and the expected baseline; neither pattern alone settles whether the change is beneficial.

How ratio metrics fit with definitions, the semantic layer, and change management is worked through in Whose Revenue Number Is Right?.

References:


Discover more from Insightful Data Lab

Subscribe to get the latest posts sent to your email.

Similar Posts

Questions, corrections, or additional insights?

This site uses Akismet to reduce spam. Learn how your comment data is processed.