System Design · medium

Two dashboards report different numbers for active users. How do you fix it for good?

Asked in Analytics Engineer interviews, in the System Design round.

Short answer

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.

How to answer it

First, diagnose

Resist rebuilding anything until you know which of these it is, in rough order of likelihood:

Different definitions   one counts any event, another counts a login,
                        a third excludes internal staff

Different time grain    calendar month against rolling 30 days, or
                        UTC against local time

Different filters       one excludes bots, trials, or churned accounts

Different source        one reads raw events, the other a modeled table
                        with deduplication applied

Different freshness     one refreshed at 6am, the other at noon

Distinct count summed   weekly actives computed as the sum of daily actives,
                        which double counts anyone returning

That last one is worth checking early, because it is common and looks like a definition problem when it is an arithmetic one.

How to find it fast

Take one day, one segment, and drill both numbers down to a list of user ids. Compare the sets rather than the totals. Whoever is in one list and not the other tells you which filter or definition differs, in minutes rather than in a meeting.

Fixing it for good

Reconciling the two numbers is not the fix; they will diverge again next quarter. The durable fix is structural:

Key points

FAQ

The 30-second answer

First I would diagnose rather than rebuild. The usual causes are different definitions of active, different time grains like calendar month against rolling thirty days, different filters such as excluding internal users, a different source table, or different refresh times. I would check early whether someone computed weekly actives by summing daily actives, because a distinct count does not add up, and that looks like a definition problem when it is arithmetic.
The fastest way to find it is to take one day and drill both numbers down to a list of user ids, then compare the sets instead of the totals.
Fixing it for good is structural rather than a reconciliation: one written definition with an owner, implemented once in the transformation or semantic layer, every dashboard reading that model, a test so a change breaks the build, and the losing dashboard deprecated. Leaving both up is what guarantees it comes back.

In the interview

Practice this for real