Sub topic 3
Profiling data: column quality, distribution, and profile
Profiling means inspecting a column's contents before you change anything. This chapter assumes you can open the Power Query Editor, connect to a CSV or Excel file, and read the Applied Steps pane. By the end you will know which three profiling tools to turn on, how to read them, and where they mislead you.
Turn on the profiling tools
All three tools are on the View tab, in the Data Preview group.
- Column quality shows three percentages for each column: Valid, Error, and Empty.
- Column distribution draws a small bar chart of value frequency. It also reports how many distinct values the column has and how many are unique.
- Column profile opens a larger panel for the selected column. It shows statistics on the left and a value distribution chart on the right.
Turn on all three. Column quality and distribution appear as a strip above each column header. Column profile appears below the grid.
Read column quality
Valid means the value loaded and fits the column's type. Error means a conversion or calculation failed. Empty means null or an empty string.
A column that reads 100% Valid still needs a look. A column typed as text accepts anything, so it can be 100% Valid while holding the word "N/A" in place of a number. Quality only reports on the current type.
Read column distribution
The distinct count is the number of different values. The unique count is the number of values that appear exactly once.
- If distinct and unique are equal, every value appears once. That is expected for an ID column.
- If an ID column has fewer distinct values than rows, you have duplicates. The Removing duplicate rows chapter covers the fix.
- If a Region column shows 9 distinct values when you expect 4, look for spelling and case variants such as "west" and "West ".
Use column profile for detail
Select a column and look at the profile panel. For numbers and dates it lists Count, Error, Empty, Distinct, Unique, Min, Max, Average, and similar statistics. For text it shows the frequency of each value. Click a bar in the chart to filter the grid to those rows. This helps when you need to see which rows carry an odd value.
Know the sampling limit
By default, profiling uses only the first 1,000 rows. A problem on row 50,000 will not show up. To profile everything, click the status bar at the bottom left of the editor and choose Column profiling based on entire data set.
A profile on a limited sample can also make a column look clean when it is not. Check the status bar text if the numbers surprise you.
A short worked example
Suppose a sales file has an Amount column that reads 100% Valid, but the distribution shows a value "abc". That cannot happen on a numeric type, so the column must be text. You have found a wrong data type. After you set the type to a number in a later chapter, quality would report 1 Error, and you can then decide how to handle it.
Exercise
A CustomerID column shows 10,000 rows, 9,400 distinct values, and 100% Valid. What does this tell you, and what should you check next?
Show answer
The column has duplicate IDs, because distinct values are fewer than rows. Valid only means the values fit the type. Next, open the column profile and click the most frequent values to see whether they are true duplicate rows or the same customer appearing in several orders. Also check whether profiling is limited to the first 1,000 rows.