2.2 Resolving Errors, Nulls, and Data Quality Issues

Key Takeaways

  • Errors in Power Query are caused by type mismatches, formula failures, or invalid data and must be resolved before loading.
  • The Remove Errors and Replace Errors steps handle error values at the column level.
  • Null values can be filled using Fill Down, Fill Up, Replace Values, or conditional logic.
  • Data type mismatches are the most common source of import errors — always set explicit types early in the query.
  • The Keep Errors step isolates error rows for investigation before removal.
Last updated: March 2026

Resolving Errors, Nulls, and Data Quality Issues

Quick Answer: Common data quality issues include type mismatch errors, null values, duplicates, and inconsistent formatting. Use Remove Errors to discard error rows, Replace Errors to substitute default values, Fill Down/Up for nulls in hierarchical data, and Replace Values for standardizing inconsistent entries.

Understanding Errors in Power Query

Errors in Power Query appear as red [Error] cells and prevent data from loading correctly. Common causes:

Error TypeCauseExample
Type mismatchText in a numeric column"N/A" in a Price column typed as Decimal
Formula errorDivision by zero, invalid function argsDividing revenue by zero units
Missing referenceColumn rename broke a downstream stepStep references "Sales" but column renamed to "Revenue"
Connection errorSource unavailable or authentication failedDatabase server offline
OverflowValue exceeds data type rangeNumber too large for Int32

Resolving Errors

Option 1: Remove Errors — Deletes entire rows containing errors

Right-click column header → Remove Errors

M code: Table.RemoveRowsWithErrors(previousStep, {"ColumnName"})

Option 2: Replace Errors — Substitutes a default value for errors

Right-click column header → Replace Errors → Enter replacement value

M code: Table.ReplaceErrorValues(previousStep, {{"ColumnName", 0}})

Option 3: Keep Errors — Isolates error rows for investigation

Right-click column header → Keep Errors

This is useful for debugging — create a reference query that keeps only errors, investigate the patterns, then handle them in the main query.

Option 4: Try-Otherwise in M — Custom error handling in formulas

try [Price] * [Quantity] otherwise 0

Handling Null Values

Null values represent missing or unknown data. The appropriate handling depends on context.

Fill Down / Fill Up

Fill Down copies the last non-null value downward — ideal for hierarchical or grouped data where headers appear only once:

Right-click column → Fill → Down

Example before Fill Down:

RegionSales
East100
null200
null150
West300

After Fill Down:

RegionSales
East100
East200
East150
West300

Fill Up works in the reverse direction.

Replace Values

Replace specific values (including nulls) with a standard value:

Right-click column → Replace Values → Value to Find: null → Replace With: "Unknown"

M code: Table.ReplaceValue(previousStep, null, "Unknown", Replacer.ReplaceValue, {"ColumnName"})

Conditional Column

Create logic-based replacements:

Add Column → Conditional Column →
  If [Status] is null Then "Pending" Else [Status]

Remove Null Rows

When entire rows are null (common in Excel imports):

Home → Remove Rows → Remove Blank Rows

Resolving Data Quality Issues

Inconsistent Values

Text data often has inconsistencies that must be standardized:

IssueSolutionM Function
Mixed caseCapitalize Each Word, lowercase, UPPERCASEText.Proper(), Text.Lower(), Text.Upper()
Leading/trailing spacesTrimText.Trim()
Extra spacesCleanText.Clean()
Inconsistent namingReplace ValuesTable.ReplaceValue()

Example: Standardizing city names:

  • "new york", "New York", "NEW YORK", " New York " → all should become "New York"

Steps:

  1. Trim to remove leading/trailing spaces
  2. Capitalize Each Word to standardize case
  3. Replace Values for known variations

Duplicate Rows

Remove exact duplicates:

Home → Remove Rows → Remove Duplicates

Remove duplicates based on specific columns:

  1. Select the columns that define uniqueness
  2. Right-click → Remove Duplicates

Warning: Remove Duplicates keeps the first occurrence. Sort the data first if you need to keep the most recent or specific record.

Data Type Corrections

Setting correct data types is critical and should be done early:

Select column → Transform tab → Data Type → Select correct type

Common type corrections:

Source DataDefault TypeCorrect Type
"2024-01-15"TextDate
"42.50"TextDecimal Number
"TRUE"TextTrue/False
"00123"Whole Number (loses leading zeros)Text
"1,234.56"Text (with locale issues)Decimal Number

Exam Tip: Always set data types as an early step in the query. If you change types after other transformations, Power Query may insert an automatic "Changed Type" step that can conflict with your manual type assignments.

Resolving Import Errors

Import errors occur when data cannot be loaded into the model:

ErrorCauseSolution
Data type conflictColumn has mixed typesSet explicit type early or split column
Circular dependencyQuery references itselfRestructure the query chain
TimeoutSource query takes too longOptimize source query or increase timeout
Memory exceededDataset too large for capacityFilter rows, aggregate, or use DirectQuery
Authentication failedExpired or incorrect credentialsUpdate in Data Source Settings

On the Exam

The PL-300 frequently tests:

  • Choosing between Remove Errors and Replace Errors for different scenarios
  • Using Fill Down to handle null values in hierarchical data
  • Identifying common causes of data import errors
  • Setting appropriate data types to prevent downstream errors
  • Understanding the order of operations in data cleaning steps
Test Your Knowledge

A Price column in Power Query contains some rows with the text "N/A" which cause errors when the column type is set to Decimal Number. You want to replace these errors with 0. What should you do?

A
B
C
D
Test Your Knowledge

An Excel import has a Region column where the region name only appears in the first row of each group, with null values for subsequent rows in that group. How should you fill in the missing region values?

A
B
C
D
Test Your Knowledge

You want to investigate which rows in a dataset have errors before deciding how to handle them. Which Power Query operation should you use?

A
B
C
D