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: The Key Didn't Match Any Rows in the Table

Refresh fails with Expression.Error: The key didn't match any rows in the table. A navigation step is looking for a sheet, table, or file by name, and it isn't there anymore. Here's how to see what is there, the five usual causes, and how to write the step so it doesn't break again.

Power QueryTroubleshooting

The full error usually looks like this:

Expression.Error: The key didn't match any rows in the table.
Details:
    Key=
        Item=Sales
        Kind=Sheet
    Table=[Table]

It comes from Power Query, during refresh or when you open the query. (It isn't a DAX error: LOOKUPVALUE returns BLANK when nothing matches.)

When you connect to an Excel workbook, a database, or a SharePoint folder and pick an item in the Navigator, Power Query writes a step that finds that item by name in a list of everything available:

let
    Source = Excel.Workbook(File.Contents("C:\Data\Sales.xlsx"), null, true),
    Sales_Sheet = Source{[Item = "Sales", Kind = "Sheet"]}[Data]
in
    Sales_Sheet

Source{[Item = "Sales", Kind = "Sheet"]} means "the row of Source whose Item is Sales and whose Kind is Sheet". The Details part of the error shows exactly that key. If no row matches, you get this error.

First: Look at What's Actually There

Open the query in the Power Query Editor and select the Source step, the one before the failing step. The preview shows the table being searched: every sheet and table in the workbook, every table in the database, every file in the folder. Compare its names with the key in the error, character by character.

The difference is usually obvious once you're looking at both. The causes below are the ones it tends to be.


Cause 1: A Sheet or Table Was Renamed

Someone renamed the sheet Sales to Sales 2026, or Sheet1 to Data. The query still asks for the old name.

Fix: select the navigation step and change the name in its formula, or select the gear next to the step to pick the item again from the Navigator.

Prevent it: in Excel, format the data as a table (Ctrl+T) with a meaningful name and connect to that (Kind = "Table"). Table names change far less often than sheet names, and a table grows with new rows automatically. See Excel.Workbook.

Cause 2: Different Capitals

Power Query compares text case-sensitively. A sheet renamed from Sales to SALES no longer matches Item = "Sales", though it looks the same to a person. This is different from DAX, where text comparisons ignore case.

Fix: match the name exactly as it appears in the Source step.

Cause 3: A Database Table Was Renamed or Moved

For SQL Server and similar sources, the key includes the schema:

Orders = Source{[Schema = "dbo", Item = "Orders"]}[Data]

If the table moved to another schema (sales.Orders), was renamed, or was replaced by a view with a different name, the key no longer matches.

Fix: update the schema and name, or ask whoever changed the database what the object is called now. See Sql.Database.

Cause 4: A File Was Moved in SharePoint or a Folder

With SharePoint folder and Folder sources, the navigation key often includes the file's folder path:

File = Source{[Name = "Sales.xlsx", #"Folder Path" = "https://contoso.sharepoint.com/sites/Finance/Shared Documents/Reports/"]}[Content]

Move the file into a subfolder, or rename the folder it's in, and the key stops matching even though the file name is the same.

Fix: find the file by name instead of by name and path:

File = Table.SelectRows(Source, each [Name] = "Sales.xlsx"){0}[Content]

This finds Sales.xlsx wherever it is in the site. If two files share the name, it takes the first, so filter on part of the path too if that can happen.

Cause 5: The Service Can't See the Item

The query works in Power BI Desktop and fails only on scheduled refresh. Desktop signs in as you; the Service uses its own stored credentials. If that account doesn't have access to the file, folder, or table, the item simply isn't in the list the query searches, and the lookup fails with the same error.

Fix: check which account the semantic model's data source credentials use, and that it can open the item. See the credentials error explained.


Make the Error Say What's Missing

The default message names the key but not the file, and it surfaces deep in a refresh log. A navigation step written to check first fails with a message anyone can act on:

let
    Source = Excel.Workbook(File.Contents("C:\Data\Sales.xlsx"), null, true),
    Matches = Table.SelectRows(Source, each [Kind] = "Table" and [Name] = "SalesData"),
    Result =
        if Table.IsEmpty(Matches)
        then error "Table 'SalesData' wasn't found in Sales.xlsx. Was it renamed?"
        else Matches{0}[Data]
in
    Result

Without the check, Matches{0} on an empty table fails with a different error, There weren't enough elements in the enumeration to complete the operation. See error handling in Power Query for error and try ... otherwise.

Don't "Fix" It by Position

Replacing the name with a position, Source{0}[Data], makes the error go away: it takes whatever the first sheet is. Then someone adds a sheet at the front of the workbook, and the report quietly loads the wrong data with no error at all. A failed refresh is better than a wrong one.

Common Mistakes

Debugging the DAX. The error comes from a Power Query step, so the report's measures aren't involved.

Fixing only the navigation step. If the new sheet has different column names, the next step fails with the column wasn't found. Check the steps after it.

Building on a sheet that users rename. Connect to a named Excel table, or agree that the source file's layout is fixed.

Looking only in Desktop. If refresh fails only in the Service, the cause is the Service's credentials or access, not the query.

Next Steps

FAQ

+What does "The key didn't match any rows in the table" mean in Power Query?

A step looked up one row of a table by its key, such as the sheet named Sales in an Excel workbook or the table dbo.Orders in a database, and no row had that key. Almost always the sheet, table, or file was renamed, moved, or deleted after the query was built.

+Is this error from LOOKUPVALUE?

No. It's a Power Query error, raised during refresh. DAX's LOOKUPVALUE doesn't raise it: when nothing matches, LOOKUPVALUE returns BLANK, or the alternate result you give it.

+How do I fix the key didn't match any rows error after renaming an Excel sheet?

Open the query, select the Navigation step, and change the sheet name in the formula, for example Source{[Item="Sales",Kind="Sheet"]} to the new name. Select the Source step first to see the exact names that exist, including capitals.

+Why does it work in Desktop but fail in the Power BI Service?

The Service uses its own stored credentials. If that account can't see the file, folder, or table, the item isn't in the list the query searches, and the lookup fails with this error. Check the data source credentials and the account's permissions on the source.