Quality rules
A rule is more useful than a clean-looking preview
Data quality means fitness for the intended business question. Write explicit checks for required fields, uniqueness at the declared grain, allowed values, valid types and lookup matches. In this retail fixture quantities must be positive whole numbers, dates valid Gregorian business dates, and product keys present in the approved clean Products table. These are fixture rules, not universal retail rules: a real return or cancellation may legitimately have a negative or zero quantity.
Example 1: audit the nine dirty sales rows
Keep sales-dirty.csv unchanged. Its first five rows match the clean baseline. For this controlled fixture only, use source position (data row 1 follows the header) to retain the first exact copy and quarantine later identical copies.
| Source row | LineID | Problem | Action |
|---|---|---|---|
| 6 | L05 | Exact repeat of row 5 | Quarantine repeated copy |
| 7 | L06 | P99 absent from clean Products | Quarantine unknown product |
| 8 | L07 | not-a-date | Quarantine invalid date |
| 9 | L08 | Quantity missing | Quarantine missing required value |
A repeated OrderID on L01 and L02 is not a failure. If two records share LineID but disagree in price or quantity, do not choose one by row order: investigate the conflict with the source owner. The separate products-dirty.csv repeats P01 with a different label, so it is an ambiguous lookup, not an approved replacement for Products.
Example 2: missing is not zero
An empty quantity field represents unavailable input under this file contract. It is not a confirmed zero sale. A conversion error means a value could not be interpreted as the expected type. Keep raw text, parsed value and error reason separate. If a future inventory record explicitly reports zero units, zero is a meaningful observation. An unknown quantity cannot be multiplied into a known revenue amount. Do not replace missing values with zero to make a total appear complete. CSV empty fields, M null, conversion errors and DAX BLANK are distinct representations; detailed semantics come later.
Inspect a dataset in Power Query
On an approved Desktop installation, import a copy of the dirty file into a separate query and inspect all nine rows. In Power Query Editor enable column quality, distribution and profile tools from the view controls. Check the profiling scope: the documented default is the first 1,000 rows, which can miss later failures in larger data; choose whole-dataset profiling where appropriate. Type conversion can reveal invalid dates. Column validity alone will not establish business rules or foreign-key matches. Power Query duplicate matching is case-sensitive; do not normalize business keys without an agreed rule. Duplicate-removal transformations do not generally guarantee which differing record survives. Native UI walkthrough only; no execution here.
Common mistakes and practice
Never remove duplicates on OrderID alone or assume a successful type conversion validates every value. Write an audit table for all nine rows, including source position, LineID, disposition and reason. Then inspect the four dirty product rows and explain why P01 requires a source-authority decision. Keep the original and the accepted/rejected outputs separate.