Part D · Chapter 15 · Trust

15. Data quality 1: measuring it

Data quality is measured, not argued about: profile the data to see what is there, write rules for what the business needs, and score each rule on one of six dimensions.

Profiling bars, then six dimensions
Playback speed

The clip profiles Kestrel's claims table column by column: how many values are empty, how many are distinct, and the smallest and largest. Three findings light up: claims with no reported date, reserves below zero and in the millions, and more cause codes than Kestrel's list. Then Kestrel's rules score six dimensions (completeness, validity, accuracy, consistency, uniqueness and timeliness), each breached dimension marked, and the rules find exactly the planted defects, with no false alarms on clean data.

The idea: profile, write rules, score them on six dimensions

Measuring quality takes three steps:

  • Profile the data before deciding anything: for each column, how many values are empty, how many distinct, the range, the patterns. A profile shows what is there, including what nobody expected.
  • Write rules for what the business needs: "a claim has a reported date", "a cause is on the list", "a reserve is between zero and the large-loss limit". Each rule checks rows and gives a score: the share of rows that pass.
  • Score each rule on one dimension, so scores can be compared and added up by asset, by domain and by company.

The six dimensions the lab uses:

  • Completeness: the value is there.
  • Validity: it is allowed (on the list, in the right format).
  • Accuracy: it is plausibly true (in a believable range, or matches the real world).
  • Consistency: it agrees with other data (the policy a claim names exists).
  • Uniqueness: it is recorded once.
  • Timeliness: it arrived soon enough to be useful.
A good rule Catches the defect it is written for and nothing else. A rule that fires on clean rows (false alarms) is soon ignored; a rule that misses the defect gives false comfort. Test every rule on data where you know the answer.
Remember Profile first, then write each rule for a defect that matters, test it on known data, and score it on one dimension.

A worked example: Kestrel's claims

Profiling Kestrel's 40 claims finds 3 with no reported date, reserves from -50,000 to 990,000,000 cents, and 10 different cause codes where Kestrel's list has 8.

The profile of Kestrel's claims, as SQL (PostgreSQL)
SELECT COUNT(*) AS row_count,
       COUNT(*) - COUNT(meldingsdatum) AS meldingsdatum_empty,
       COUNT(DISTINCT meldingsdatum) AS meldingsdatum_distinct,
       MIN(meldingsdatum) AS meldingsdatum_min,
       MAX(meldingsdatum) AS meldingsdatum_max,
       COUNT(*) - COUNT(oorzaak_code) AS oorzaak_code_empty,
       COUNT(DISTINCT oorzaak_code) AS oorzaak_code_distinct,
       COUNT(*) - COUNT(reserve_cent) AS reserve_cent_empty,
       COUNT(DISTINCT reserve_cent) AS reserve_cent_distinct,
       MIN(reserve_cent) AS reserve_cent_min,
       MAX(reserve_cent) AS reserve_cent_max
FROM schades

Kestrel's eight rules then score the data: 8 of them are breached, and together they find 19 failing rows, every one of them planted. The reserve rule, as the lab writes it in SQL:

Kestrel's reserve rule: the claims that fail it (PostgreSQL)
SELECT schade_id AS k FROM schades WHERE NOT COALESCE(reserve_cent BETWEEN 0 AND 10000000, FALSE) ORDER BY schade_id
Kestrel's data on six dimensions
DimensionRulesBreachedScore
Completeness1192.5%
Validity2294.2%
Accuracy1195.0%
Consistency2296.5%
Uniqueness1193.3%
Timeliness1187.5%
Try this In the Quality workbench, switch the estate to Kestrel and look at the scores per dimension: every rule is breached, and none has an owner.

Why it matters for Alex

"Kestrel's data is bad" is an opinion that stalls a merger. "Kestrel's claims fail six of eight rules, on these rows" is a work list. Alex needs the second, with the rules written down so both companies agree what good means.

Scores by dimension also show where to start: missing reported dates are a broker-portal problem, unknown codes a reference-data problem (chapter 20), duplicates a master-data problem (chapter 18).

Where it goes wrong

  • Rules from a template. A hundred generic checks on every column produce a hundred scores nobody needs. Write rules for the uses that matter.
  • Untested rules. "A reserve is more than zero" sounds right and flags every closed claim. Test each rule on data where you know the answer.
  • One score for everything. An average over all rules hides the one that matters. Keep the dimensions, and keep each rule visible.
  • Profiling once. Data changes with every release; profile on a schedule, and before every migration.

Exercises

The lab checks each one against facts written down in advance, so any answer the brief allows passes. A pass is kept in this browser.

Read the profile

Each finding comes from profiling Kestrel's data. Choose the quality dimension it puts at risk.

meldingsdatum is empty on some claims.
reserve_cent runs from below zero to far more than any claim Kestrel insures.
oorzaak_code has more distinct values than Kestrel's list of cause codes.
Some polis_id values are not in polissen.
Two rows of klanten have the same name and the same birth date.
Some claims were reported more than 90 days after the loss.

Judge the proposed rules

A colleague proposes these rules for Kestrel's data, each for one of the planted defects. Judge each one by what it finds on the data.

A schade's cause is one of Kestrel's codes (for unknown cause codes)
A schade's cause code is filled in (for unknown cause codes)
A reserve is more than zero (for impossible reserves)
A reserve is between 0 and 10,000,000 cents (for impossible reserves)
A schade is reported within 14 days of the loss (for late reports)
Each customer name is used once (for the customer entered twice)
A customer is recorded once (name and birth date) (for the customer entered twice)
A schade's policy number is filled in (for claims on a policy that does not exist)
A schade's policy exists (for claims on a policy that does not exist)

Name each rule's dimension

These are Kestrel's eight rules. Choose the dimension each one scores.

A schade has a reported date (meldingsdatum)
A schade's cause is one of Kestrel's codes
A reserve is between 0 and 10,000,000 cents
A schade is reported within 90 days of the loss
A schade's policy exists
A customer is recorded once (name and birth date)
An email address has a valid format
A polis ends after it starts

On Azure

Checked against Microsoft's documentation on 18 October 2026.

On Azure, data quality is measured in two places:

  • Microsoft Purview's Unified Catalog profiles data assets and runs data quality rules on them (built-in checks such as empty values, uniqueness, formats and freshness, and rules of your own), with scores per asset, data product and governance domain.
  • In the pipelines: Azure Databricks' Lakeflow Declarative Pipelines (formerly Delta Live Tables) declare expectations on each table, and Microsoft Fabric notebooks and pipelines can run the same checks in SQL or Python as they load (chapter 17).
  • Profiling is in both: Purview's profiles, and the data profile Azure Databricks shows for a table.

Write each rule once, as SQL the lab can test, and run it where the data lands; publish the scores to the catalogue where people look.

Take it to work

Quality rule card

Write one data quality rule so that it can be run, tested and owned.

The rule

  • What must be true of each row, in one sentence
  • Its dimension

The check

  • The SQL, or the tool's rule, that tests it
  • The data it was tested on, and what it found

The threshold

  • The share of rows that must pass, and why (chapter 16)

The owner

  • Who acts when it fails, and what do they do? (chapter 16)

Tools in this chapter

  • Quality workbench · Write quality rules, set thresholds, inject defects, and see the scores per dimension and per domain.

Terms taught here: Data qualityData profilingData quality dimensionData quality rule

An unhandled error has occurred. Reload 🗙

Reconnecting…

Your connection to the Cloud Data Architecture Lab dropped, probably a Wi-Fi blip. Hold on while it reconnects.

The connection could not be restored. The page will reload in a few seconds.