Skip to the workspace
Pebellslearn by building
Cleaning Data with Power Query  ›  Capstone Project

Data Profiling and Handling Errors

Handling Errors 14 minColumn quality, distribution and profile views reveal a column's health, and errors are best handled at their cause, with null usually a safer stand-in than zero.

power bi / Data Profiling and Handling Errors

Explore each scene at your own pace.

01 · The rule

The rule

Data Profiling and Handling Errors

The Qty column now has a type, but somewhere in 20,000 rows a few cells say Error, and nobody knows how many or why. Scrolling to find them would take all afternoon. Power Query can summarise every column's health in a glance, and then give you three clean ways to deal with what it finds.

The rule

Profile the whole column, then fix errors at their cause, not just the cell.

Three profiling views live on the View tab:

  • Column quality puts a bar under each header: the percentage of values that are Valid, Error and Empty.
  • Column distribution shows how many distinct and unique values a column has, with a small histogram. Distinct counts the different values; unique counts the values that appear exactly once. For Pune, Pune, Mumbai, Delhi there are 3 distinct values and 2 unique ones.
  • Column profile opens a panel for the selected column: count, errors, empties, minimum, maximum, average and a chart of how often each value appears.

By default these views look at only the top 1,000 rows, as the status bar at the bottom says. Click that message and choose profiling based on the entire data set when trouble might be further down.

Errors come in two sizes:

  • A cell-level error hits one value, such as N/A that cannot become a number. The rest of the query runs.
  • A step-level error stops the whole query: the source file has moved, or a step asks for a column that no longer exists.

For cell-level errors, right-click the column header:

Action Effect Use it when
Keep Errors Shows only the rows with errors You are investigating
Remove Errors Deletes those rows The whole row is junk
Replace Errors Puts a value in place of each error A sensible stand-in exists, usually null

Often the best fix is upstream. If the till writes N/A for "not recorded", add a step before Changed Type that replaces N/A with null, and the error never happens.

Prefer null to 0 as a stand-in. Averages skip nulls but count zeros: prices of 30, 40 and a replaced error average 35 with null, but about 23.33 with 0.

Scene 1 of 5
Hover to wake the cannons. Drag to move, or use arrow keys when focused. Press Enter to fire a shot.