System Design · medium
Asked in Analytics Engineer interviews, in the System Design round.
The cause is two definitions, not a data bug. Define the metric once in a shared model or a semantic/metrics layer and have both dashboards read it, instead of each re-deriving it in its own SQL. Encode the grain and filters (which events, what window, the dedup rule) in one tested model. The fix is governance — a single source for the definition — not another patch on one dashboard.
The cause is two definitions in two places, not a data bug. Fixing the data reconciles them once; fixing the definition reconciles them forever.
First, find the difference precisely. Pull both queries and diff the logic: which events count as activity, what window (calendar day or trailing 24 hours), which users are excluded (internal, test, bots), and how duplicates are handled. The gap is always in one of those four.
Then:
active_users_daily with the grain, the window, the filters, and the dedup rule encoded in SQL that both dashboards read.engaged_users_daily), not a different implementation of the same name.Then the governance part, said briefly: someone owns the metric, changes to it go through review, and the semantic layer or metrics layer, if the stack has one, is where it lives.
Worked line: "Marketing counted a page view as activity with a trailing-24-hour window; product counted a session start on a calendar day. Both were right by their own definition. One model, active_users_daily, calendar day, session start, internal users excluded; both dashboards read it. The 12% gap is gone and the word 'active' means one thing."