New: free Power BI model health check. Find what's making your numbers wrong and your model slow. Check your model →
← Back to Blog

Power Query Error: We Cannot Convert the Value Null to Type Table

A step that needs a table was handed null instead. Power Query doesn't produce that null on its own: filters and merges return empty tables, not null. It almost always comes from a fallback or a custom function that returns null. Here's how to find it and what to return instead.

Power QueryTroubleshooting

The error reads:

Expression.Error: We cannot convert the value null to type Table.
Details:
    Value=
    Type=[Type]

A function that only works on tables was given null. Almost every Table.* function does this when handed null: Table.SelectRows, Table.RowCount, Table.Combine, Table.AddColumn, and the rest.

The useful thing to know is where null doesn't come from:

SituationResult
A filter that matches no rowsAn empty table, not null
A left outer merge with no match for a rowAn empty nested table, not null
Navigating to a sheet or table that doesn't existA different error: the key didn't match any rows

So when you see this error, look for code that deliberately produces null: usually a fallback, a conditional, or a custom function.

Find the Step

Select each step in Applied Steps in turn. The error appears on the step that receives the null, but the cause is whatever produced it, often a step or two earlier, or inside a function the step calls. Check the step that the failing one refers to: if its preview shows null instead of a table, that's the one to fix.


Cause 1: A Fallback That Returns null

A step written to survive a missing source returns null when it does:

Data = try Source{[Item = "Sales", Kind = "Sheet"]}[Data] otherwise null,
Filtered = Table.SelectRows(Data, each [Amount] > 0)

When the sheet exists, Data is a table. When it doesn't, Data is null, and the next step fails with this error, which hides the real problem: the sheet is missing.

Fix: decide what should happen when the source is missing. Either let it fail with a clear message:

Data = try Source{[Item = "Sales", Kind = "Sheet"]}[Data]
    otherwise error "The Sales sheet is missing from this workbook."

or return an empty table with the expected columns, so the rest of the query runs and produces no rows:

Data = try Source{[Item = "Sales", Kind = "Sheet"]}[Data]
    otherwise #table(type table [Date = date, Amount = number], {})

Cause 2: A Custom Function That Returns null for Some Inputs

A function called once per row, or once per file, that returns null when it finds nothing:

GetOrders = (customerId as text) =>
    let
        Rows = Table.SelectRows(AllOrders, each [CustomerID] = customerId)
    in
        if Table.IsEmpty(Rows) then null else Rows

Then a later step combines the results, and the first null stops it:

Combined = Table.Combine(Table.Column(WithOrders, "Orders"))

Fix: return an empty table instead of null. Here, just return Rows: it's already an empty table with the right columns when nothing matches. In general, a function that returns a table should always return a table.

Cause 3: A Function Parameter That Receives null

A function declared with (t as table) => ... and invoked with a column that has empty cells receives null for those rows, and fails as soon as it treats the parameter as a table. This often happens after a step that leaves some cells empty, such as an expand where a nested value was missing.

Fix: filter out the null rows before invoking the function, Table.SelectRows(Source, each [Data] <> null), or handle null inside the function and return an empty table.


Make Empty Results Look Like Real Ones

The pattern behind all three fixes: when there's nothing to return, return an empty table with the same columns rather than null or #table({}, {}). A table with no columns can still break a later step that refers to a column by name. Building it with a typed column list keeps everything after it working:

Empty = #table(type table [CustomerID = text, OrderDate = date, Amount = number], {})

Common Mistakes

Blaming a filter or a merge. They return empty tables, not null. Look for a fallback or a function.

Wrapping the failing step in try ... otherwise. The error moves somewhere else, and the real cause, often a missing source, stays hidden.

Returning #table(, ). It avoids this error and then fails one step later, when something refers to a column that doesn't exist.

Next Steps

FAQ

+What does "We cannot convert the value null to type Table" mean?

A function that needs a table, such as Table.SelectRows, Table.Combine, or Table.RowCount, received null. Something earlier produced null where a table was expected, usually a try ... otherwise null fallback or a custom function that returns null for some inputs.

+Does a filter that matches nothing return null?

No. Table.SelectRows returns an empty table with the same columns when nothing matches, and a left outer merge gives unmatched rows an empty nested table. Neither causes this error.

+What should a function return instead of null when it finds nothing?

An empty table with the columns later steps expect, for example #table(type table [Name = text, Amount = number], {}). Then appends, expands, and column references keep working.