← All writing

One metric, six answers

The most expensive data problems I run into are not wrong numbers. They are numbers that are each correct under their own definition, sitting in systems that never compare notes.

Here is the shape of it. Somebody asks a simple question:

How many leads did we get last month?

Simple, until you check where the answer comes from. The reporting dashboard runs one query. The client portal runs another. A Python job that uploads conversions to the ad platform applies a third rule. Somebody's saved SQL view has a fourth. None of them throw an error. All of them return a plausible number. And each one is defensible in isolation.

Why this happens

A threshold gets written into code the first time somebody needs it. Six months later a second consumer needs the same idea, in a different language, and the author writes it again from memory. Not from the original — from memory of a conversation about the original.

Every restatement is a chance to drift. Somebody rounds a boundary. Somebody uses > where the first one used >=. Somebody forgets an exclusion that existed for a reason nobody wrote down.

The drift is invisible because each copy works. The failure only surfaces when two people quote different numbers in the same meeting, and by then both have been used to make decisions.

The fix is boring

Put the rule in the database, once. Not the answer — the rule.

  • Thresholds go in a config table.
  • The verdict goes in a view that reads that table.
  • Every consumer reads the boolean. Nobody restates the comparison.

The test for whether you have done this correctly: changing the definition should be one UPDATE statement, with no deploy, and every surface should change together.

If changing a definition requires touching code in more than one language, you do not have a definition. You have several.

The part people skip

Fixing the drift is the easy half. The harder half is going back and finding out which decisions were made on which version, because the wrong number does not announce itself. It just sits in a slide somebody already presented.

So when you consolidate, print the before and after side by side and look at the delta. If a number moves more than you expected, that gap is the size of the problem you have been carrying.