Column profiling
What a profile tells you
Data profiling summarizes the condition and distribution of a table before you decide how to clean it. In Power Query Editor, enable Column quality, Column distribution and Column profile from the View area (exact placement may vary by build). Quality separates valid, error and empty values as reported by the engine. Distribution shows distinct values and values that occur exactly once; profile gives detailed statistics for a selected column. A technically valid text value can still violate a business rule. For example, a category named Unknown is valid text but may be disallowed by a retail event contract. Profile before and after transformation; record the population, types and filters at each step. This chapter uses an offline synthetic USD event stream; native Desktop and M execution are NOT RUN.
Example 1: a clean preview can hide bad rows
Imagine 1,002 records in a fixed order: the first 1,000 contain usable timestamps, row 1,001 contains malformed text and row 1,002 is null. The first 1,000 appear clean, but full-population validation finds 1,000 usable timestamps, one invalid and one missing. That is about 99.80% usable, not 100%. Power Query profiling defaults to the first 1,000 rows; choose the entire dataset option where appropriate. The default is not a random sample or a guarantee about the full input. A preview may also differ from a future refresh. Define the population, record the actual refresh identifier and avoid making a costly full profile against an unapproved source.
Example 2: profile duplicate identifiers
The lab has eight delivery rows. Event IDs in arrival order are E1, E2, E1, E3, E4, E5, E2, E7. There are six distinct identifiers; four occur exactly once. This differs from the eight-row count. Two identifiers occur twice. Do not remove every repeated ID automatically: one repetition is an exact replay and the other is a conflicting payload. To inspect frequency explicitly, use a small inline table:
let T = #table(type table [EventID=text], {{"E1"},{"E2"},{"E1"},{"E3"},{"E4"},{"E5"},{"E2"},{"E7"}}), Counts = Table.Group(T, {"EventID"}, {{"Rows", each Table.RowCount(_), Int64.Type}})in CountsExpected unordered counts: E1=2, E2=2, E3=1, E4=1, E5=1, E7=1. Grouping does not promise a row order; sort for display if needed. For a general column-statistics table, Table.Profile(T) is another documented function; it is not a substitute for domain validation.
From observation to a quality gate
Write a measurable rule such as EventID must be nonempty text and Category must be one of Stationery or Lighting. Count the violations and reconcile them to the raw population. Treat an error caused by parsing differently from a null input or an unknown category. Avoid percentages without a denominator: two repeated keys do not mean two rejected rows until replay and conflict rules are applied. Run source-level checks if the dataset is too large to profile locally, and record the exact source snapshot. A profile is evidence about the data it observed, not a constraint on later data.
Practice: inspect a sample
Using the lab file, count rows, distinct EventIDs, IDs appearing once and rows belonging to repeated IDs. If you only inspected the first two rows, which problems would be invisible? Explain why a valid text category can fail a business rule.