MSBA-260 · Lesson 3 of 12 · 19 min
Profiling data quality
▶ Video coming soon A video version of this lesson is on the way.
The first real test of the rebuild came from the registrar's office. Maribeth Ferreira-Quon sent Kwabena a request: a count of active students by program for the board meeting. His first draft showed 41 programs. The college offers 34. "Where did the other seven come from?" she asked. Kwabena already suspected the answer: the same program spelled in different ways, a few test records, and a code that had been retired but still appeared on old enrollments. He had not looked at the data before building on it. This lesson is about looking first.
The PL-300 objective is *evaluate data, including data statistics and column properties*. Power Query has three profiling tools for this, all on the View tab of the editor: Column quality, Column distribution and Column profile. Together they answer the questions every analyst should ask of a new table: is anything missing, is anything broken, how many different values are there, and do those values look the way I expect?
Profiling is based on the first 1,000 rows by default
Before reading any profile, check the status bar at the bottom of the editor. By default, profiling statistics are calculated from the top 1,000 rows of the preview. A column can look perfect in the first 1,000 rows and contain errors in row 50,000. To profile everything, select the text in the status bar that says *Column profiling based on top 1000 rows* and switch it to *Column profiling based on entire data set*. Profiling the whole table takes longer, because Power Query must read all of it, so do it deliberately on tables where quality matters.
Kwabena's 41 programs came partly from this trap. His preview of 1,000 rows looked clean, and only when he profiled the entire enrollment history did the misspellings from older terms appear.
Column quality
Column quality adds a small bar under each column header showing three percentages: Valid, Error and Empty. Valid values are ordinary values of the column's type. Errors are cells where a step failed, for example converting the text "N/A" to a number. Empty means null or an empty string. Hovering over the bar shows the counts, and offers quick actions such as Remove errors or Replace errors.
A Valid share of 100 does not mean the data is correct. It only means every value is of the expected type. A column of program codes can be 100 percent valid and still contain three spellings of the same program. Column quality finds structural problems; the other two tools help find content problems.
Column distribution
Column distribution adds a small bar chart under each header showing how often values occur, with two counts: distinct values (how many different values appear) and unique values (how many appear exactly once). The difference matters. In a column of five values, A, A, B, C, C, there are three distinct values (A, B and C) and one unique value (B, which appears only once).
The two counts are powerful clues. A column intended as a key, such as StudentID in a student table, should have distinct and unique counts both equal to the row count: every value appears once. If distinct is lower than the row count, there are duplicates, and the column cannot be the one side of a relationship. In a column that should have a small set of values, such as Campus, a distinct count of 7 when there are three campuses tells you to look for spelling variants.
Worked problem
Reading distinct and unique counts
A student table has 18,240 rows. Column distribution for StudentID shows 18,236 distinct and 18,232 unique values. What does this tell Kwabena?
Show solution
- If every ID appeared once, distinct and unique would both be 18,240.
- Distinct is 18,236, so 4 rows repeat an ID that already appears: 18,240 - 18,236 = 4 extra rows.
- Unique is 18,232, so 18,236 - 18,232 = 4 IDs appear more than once.
- So four IDs each appear exactly twice: duplicate student records.
Answer: Four student IDs are duplicated. Until they are resolved, StudentID cannot be a unique key, and a relationship from enrollment to this table would fail or be many-to-many.
Column profile
Column profile gives a detailed pane at the bottom of the editor for the selected column. It shows column statistics, such as count, error, empty, distinct and unique counts, plus type-specific measures: for numbers, minimum, maximum, average, standard deviation and the count of zeros and NaN values; for text, the minimum and maximum values alphabetically and the count of empty strings. It also shows a value distribution chart, which can be grouped differently depending on the type, for example by text length, by first letter, or for dates by year, month or day of the week.
| Tool | Where it appears | Best for finding |
|---|---|---|
| Column quality | Bar under each column header | Errors and empty values |
| Column distribution | Mini chart under each header, with distinct and unique counts | Duplicates, unexpected variety, candidate keys |
| Column profile | Pane below the preview for the selected column | Ranges, outliers, value patterns, statistics |
Kwabena used the column profile on the Credits column and found a minimum of minus 3 and a maximum of 99. Credit loads at Lumenvale run from 0.5 to 21 in a term. The negative values turned out to be reversals entered when students withdrew, and 99 was a placeholder used by an old system for audit-only registrations. Neither was an error that column quality would flag: both were valid numbers. Only the statistics revealed them.
Column properties: data type and more
Profiling also means reading each column's properties. The most important is the data type, shown by an icon at the left of the header: 123 for whole numbers, 1.2 for decimals, a calendar for dates, ABC for text, a mixed icon for Any, which means no type has been set. The type matters for everything downstream: a date column typed as text cannot be filtered by month; numbers typed as text cannot be summed; a column left as Any is loaded as text into the model. Lesson 4 covers choosing types properly.
Other properties visible in the editor include the column name, which becomes the field name users see, and in Query Settings the query's own name and description. Good naming at this stage saves trouble later. Rupert asked for a short naming convention: business-friendly names with spaces in the final model (Program Name rather than PRG_NM), and fact and dimension tables named clearly, such as Enrollment and Program.
A profiling routine
After the board-report embarrassment, Kwabena adopted a routine for every new table, which he pinned in the team's OneNote: switch profiling to the entire data set; check column quality for errors and empty values; check distinct and unique counts on keys and categories; read the column statistics for ranges and outliers; and record each finding with a decision.
The last step, recording findings, turned out to be the most valuable. Each finding became either a cleaning step in Power Query, a question for the data owner, or a known issue documented for report users. The duplicate student IDs, for example, were not Kwabena's to fix: they came from a merge of two student systems years earlier, and only the registrar could decide which record was right. He reported them to Maribeth and, until she fixed them, kept a step that removed the older duplicate in each pair, with a comment explaining why.
Profiling the program codes
Back to the 41 programs. Column distribution on ProgramName showed 41 distinct values. Kwabena right-clicked the column and chose Group By with a row count to list every value and how often it appeared (lesson 6 covers grouping). The list showed the culprits: "Practical Nursing" and "Practical Nursing " with a trailing space; "Business Admin" and "Business Administration"; "HVAC Technician" and "Hvac Technician"; two test programs named "TEST - do not use"; and an old program, "Office Administration," retired three years before but still on historical enrollments.
| Problem found | Cause | Fix (lesson) |
|---|---|---|
| Trailing spaces | Manual entry | Trim (lesson 4) |
| Different capitalization | Two source systems | Capitalize Each Word or a lookup table (lessons 4 and 5) |
| Abbreviated names | Older import | Replace values or merge with the official program list (lessons 4 and 5) |
| Test records | System testing in production | Filter rows (lesson 4) |
| Retired program | Historical data | Keep, but flag as inactive (lesson 4) |
The best fix for most of these was not to repair each spelling one by one, but to use the registrar's official program list as the source of truth and match enrollments to it by program code rather than by name. Names are for display; codes are for matching. That principle, matching on keys rather than labels, returns in lesson 5.
Profiling and performance
Profiling has a cost. With profiling on the entire data set, Power Query reads every row of a table each time the preview refreshes. On a table of millions of rows from a slow source, that can make the editor sluggish. A sensible approach is to profile the entire data set once when you first meet a table and after big changes, then return to the default top 1,000 rows for day-to-day editing. Profiling settings affect only the editor; they never change what is loaded at refresh.
Profiling is also not available everywhere in the same form. In Power Query Online, used by Dataflow Gen2 and other web experiences, the same three tools exist on the View tab, and a data profiling setting on the status bar controls whether the whole data set is used. The concepts are identical.
Profiling a whole model, not just one table
Profiling one table at a time misses problems that only appear between tables. Before building relationships, Kwabena checked that the keys on both sides matched. He compared the distinct ProgramCode values in Enrollment with those in the official program list by referencing both queries, keeping only the code column, removing duplicates and merging them with a left anti join (the technique lesson 5 covers). Codes in enrollments that were not in the list would have become blank rows in every report by program. He also compared row counts with the source owners' own figures: the registrar's system reported 18,240 student records, and his Student query loaded 18,240 rows before cleaning. Matching counts at the start make it much easier to explain any difference later.
Dates deserve their own check. Column profile on a date column can group the value distribution by year or month, which shows gaps and spikes at a glance. Kwabena's enrollment dates showed a sudden spike on 1 January 1900, a classic sign of a placeholder date in an old system. A histogram of credits by term showed the summer term with far fewer rows, which was expected, but also one fall term with almost none, which turned out to be an extract that had failed years earlier. Neither problem would show in column quality: every value was a valid date or number.
Turning findings into rules
A profile is a snapshot. Data changes after the report is published, and the problems found today can return next term. Kwabena turned his most important findings into rules that ran on every refresh. One query counted rows with a null ProgramCode, another counted credits outside the range 0 to 21, and a third listed student IDs that appeared more than once. He loaded the three results as a small Data Quality table and put a page in the report showing each count with the date of the last refresh. Maribeth checked the page each Monday. When a count jumped, she knew before anyone made a decision on bad numbers.
Rupert liked the approach for another reason: it made quality visible to the people who could fix it. A problem hidden in a cleaning step is invisible to the source system's owner, and it stays in the source forever. A problem shown on a page with a count and an owner usually gets fixed.
What the exam asks about profiling
Exam questions on this objective tend to describe a symptom and ask which tool shows it. If the question mentions errors or blanks, think column quality. If it mentions duplicates, keys or how many different values a column has, think column distribution and its distinct and unique counts. If it mentions minimum, maximum, average or the pattern of values, think column profile. And if a question says the profile looked clean but the loaded data has problems, the likely answer is that profiling was based only on the top 1,000 rows.
Common mistakes
MistakeTrusting a clean-looking preview.
InsteadProfile the entire data set; problems often hide beyond the first 1,000 rows.
MistakeReading 100 percent Valid as correct data.
InsteadValid only means the type matched; check distributions and statistics for content problems.
MistakeConfusing distinct and unique.
InsteadDistinct counts different values; unique counts values that appear exactly once.
MistakeFixing source-system problems silently in Power Query.
InsteadReport them to the data owner and document any temporary cleaning step.
Summary and key terms
- Column quality shows valid, error and empty shares; column distribution shows distinct and unique counts; column profile shows statistics and value distribution.
- Profiling uses the top 1,000 rows unless you switch it to the entire data set in the status bar.
- A key column must have distinct and unique counts equal to the row count.
- Statistics such as minimum and maximum reveal valid but implausible values.
- Record each finding as a cleaning step, a question for the owner or a documented known issue.
- Column quality
- A profiling view showing the share of valid, error and empty values in each column.
- Column distribution
- A profiling view showing value frequency with distinct and unique counts.
- Column profile
- A detailed pane of statistics and value distribution for one column.
- Distinct count
- The number of different values in a column.
- Unique count
- The number of values that appear exactly once.
- Any type
- The data type of a column that has not been given a specific type.
Practice problems
Work each problem on paper first, then reveal the answer to check.
A column has values X, Y, Y, Z, Z, Z. What are the distinct and unique counts?
Show answer
Distinct 3 (X, Y, Z); unique 1 (only X appears once).
Where do you change profiling from the top 1,000 rows to the whole table?
Show answer
In the status bar at the bottom of the Power Query editor.
Why might Credits be 100 percent valid yet still wrong?
Show answer
Values can be valid numbers but implausible, such as negative reversals or a placeholder of 99.
Lesson quiz · 5 questions
Score 60% or more to complete this lesson.
Create a free account to save your progress, take quizzes and earn a certificate.