Data Quality Before Dashboards: Five Tests That Prevent Misleading Metrics
A dashboard can look finished and still be wrong. The chart renders, the trend line goes up, and nobody notices that the number underneath changed meaning three weeks ago.
Picking a better chart type won't fix that. Testing the data before anyone looks at the visual will.
This piece is adapted from a MeritSOLVβ’ Research & Insights guide on data quality. The scenario below is illustrative, not a client report.
Why good-looking dashboards drift
Source definitions change quietly. A system gets upgraded, a status value gets renamed, a team starts logging an event at a different step. The dashboard keeps pulling the same field and shows the new number with no warning that it now means something else.
Here's a quick check you can run today. Pick one headline metric and write down exactly how it's calculated: the event that counts, the time basis, the grain and what gets excluded. Then ask the metric owner and one regular user to explain it in their own words. If the two explanations don't match each other, or don't match the query, fix the definition before you touch the chart.
A worked example
Say a sales dashboard shows 12% quarter-over-quarter growth. An analyst digs in and finds the source system switched the revenue event from "booked" to "invoiced" halfway through the quarter. Half the quarter counts one thing and half counts another. The growth number is real arithmetic on two different definitions.
Before visualizing anything, document five things for each metric:
- unit of measure
- time basis
- grain
- inclusion rules
- reconciliation source
A metric without an owner and a written definition should sit in draft status, no matter how plausible it looks.
The five tests
| Test | Simple method | What to do with the result |
|---|---|---|
| Completeness | Non-null required fields divided by eligible records | Report the null rate by source |
| Uniqueness | Compare composite business keys | Investigate duplicate events |
| Timeliness | Latest record timestamp vs expected refresh | Flag stale periods |
| Validity | Check allowed status values and ranges | Confirm outliers, don't delete them |
| Reconciliation | Sum signed source amounts vs the ledger | Separate rounding from missing rows |
None of these need a special platform. Plain SQL against a staging table gets you most of the way. The queries below are illustrative, with made-up table and column names, so adapt them to your own schema.
Completeness - Share of rows missing a required field, by source system
SELECT source_system, COUNT(*) AS total_rows, SUM(CASE WHEN customer_id IS NULL THEN 1 ELSE 0 END) AS missing_customer, ROUND(100.0 * SUM(CASE WHEN customer_id IS NULL THEN 1 ELSE 0 END) / COUNT(*), 2) AS pct_missing FROM stg_orders GROUP BY source_system
Uniqueness - Business keys that appear more than once
SELECT order_number, line_number, COUNT(*) AS copies FROM stg_orders GROUP BY order_number, line_number HAVING COUNT(*) > 1
Use the business key here, not the surrogate ID. Surrogate keys are unique by design, so they'll never show you a duplicate event that got loaded twice.
Timeliness - How old is the newest record compared with what the refresh schedule promises?
SELECT MAX(loaded_at) AS latest_load, CURRENT_TIMESTAMP - MAX(loaded_at) AS lag FROM stg_orders
Compare the lag with the documented refresh window. If the dashboard says "daily" and the lag is three days, the dashboard should say so on the page.
Validity - Status values outside the allowed list, and amounts outside a sane range
SELECT status, COUNT(*) AS row_count FROM stg_orders WHERE status NOT IN ('open', 'invoiced', 'paid', 'refunded', 'canceled') GROUP BY status;
SELECT order_number, amount FROM stg_orders WHERE amount < 0 AND status <> 'refunded';
An outlier isn't automatically an error. Confirm it with the owner before you filter it out, and record the decision if you do.
Reconciliation - Compare signed totals per month against the system of record
SELECT s.period, s.total AS staged_total, l.total AS ledger_total, s.total - l.total AS difference FROM ( SELECT DATE_TRUNC('month', invoiced_at) AS period, SUM(amount) AS total FROM stg_orders GROUP BY 1 ) s FULL OUTER JOIN ledger_monthly l ON l.period = s.period ORDER BY s.period
Small differences are often rounding or currency conversion. Larger ones usually mean missing or duplicated rows. Write down whatever you can't explain. Don't keep tuning filters until the totals happen to match, because that's how a wrong number gets locked in.
A five-step method
- Define the question and the owner first. Before touching data, get the metric owner to state the business decision it supports, the numerator, the denominator, the time grain, the unit or currency and the exclusion rule.
- Profile the data. Run the five tests above with sample counts and source timestamps. Watch for schema changes that could silently bend a trend.
- Write transformation rules as testable mappings. Include the edge cases people forget: refunds, null timestamps, canceled records, time zones and revised historical transactions. Keep the transformations in version control and sample the records you exclude.
- Reconcile against a trusted sample. Compare an approved sample with the upstream system or ledger. Document the differences you can't resolve.
- Publish the spec with the dashboard. Ship a metric dictionary, a short lineage summary, the refresh schedule, the owner and known limitations alongside the release. If the dashboard covers a financial or regulated process, bring in the business or control owner for that process before you publish anything presented as the official number.
What done looks like
You should end up with a data dictionary, transformation rules and documented test results that show provenance, version, owner and open exceptions. The sponsor should be able to see what was decided, what wasn't and which actions are still open.
A simple acceptance test: ask someone outside the team to find the latest artifact, name its owner, explain the top unresolved issue and say what the next approved action is. If any of those answers lives only in someone's head, the handoff isn't finished.
The mistake that shows up most
Teams track dashboard adoption and never check whether the numbers reconcile. High usage of a wrong number just spreads the wrong number faster. Use the smallest set of artifacts that shows scope, evidence, review and the next decision, and automate the tests only after the responsibilities and exceptions are clear.
Checklist
- [ ] Define the business question and metric owner before touching data
- [ ] Profile completeness, uniqueness, timeliness, validity and consistency
- [ ] Write transformation rules with examples and edge cases
- [ ] Test reconciliations against a trusted approved sample
- [ ] Publish a reporting spec with definitions and exclusions
- [ ] Confirm who approves the final output and how corrections get handled
- [ ] Archive the approved version and set the next review date
Synthetic or redacted samples work fine for validating these rules before you get approval to run them on real data.
Further reading
FCSM A Framework for Data Quality (FCSM 20-04)
This is general operational information, not legal, audit or certification advice. Review the cited standards and apply your organization's requirements.
Originally published at meritsolv.com.
Comments
No comments yet. Start the discussion.