Showing results for 
Search instead for 
Did you mean: 

Expression Error.: The key didn't match any rows in the table




I need help to understand this error message (above image) and how to fix it, thanks 


 A typical case would be when you connect to an Excel file and then your Query attemps to access a Sheet that does not exist in the Spreadsheet...

View solution in original post

New Member

New Member

- Click duplicate on source on the right ( Applied step)

- It show a table--> You can see at the Hiddens column--> It's "False"

- Click on "Table" on Data column.

- It's show a msg box (Pic 2) --> Choose continuos 

It's solved



Thank you, this was my solution. But I needed to re-create all steps afterwards. In my case it was easy...

New Member

I got this error, when I changed the table name in PowerBI Desktop (Fields category) 

Frequent Visitor

I had the same error message connecting to a tabular model via visual studio.


When I validated the query, "The query statement is valid."

Going into the "Design" view is when I got the error.


I fixed it from the "Query" menu, selected refresh query, and it worked.



Frequent Visitor

I had the same problem today.


This is how I fixed it:

Make sure to go under advanced editor on Power BI



I conected my excel workbook as tables inside Power BI, so in this case you need to make sure that the file location, file name and most important, table name is correct.


Source = SharePoint.Files("FILE LOCATION", [ApiVersion = 15]),
#"FILE NAME xlsx_FILE LOCATION" = Source{[Name="FILE NAME.xlsx",#"Folder Path"="FILE LOCATION"]}[Content],
#"Imported Excel Workbook" = Excel.Workbook(#"FILE NAME xlsx_FILE LOCATION"),
Table = #"Imported Excel Workbook"{[Item="TABLE NAME",Kind="Table"]}[Data]


How do you change a table name in excel?


Go under Formulas Tab > Name Manager


Select the table you want and click edit. This name should be the one you have to insert under Power BI conection above



Make sure to do this to every imported table on you model



New Member

I started having this error after populating the file path with daily workbooks where the name of the sheet wasn't the same as my query / Transform Sample File 

(My power query reads from many workbooks wich are the same except for the name of the sheet which is named after each workbook)

The query was attemping to find in all the workbooks the same sheet name as in my data transformation example.


I tried to sorted it out by removing the Navigation stept in the query but did not work.


How did it work? >In the Transform Sample File, I opened the Advanced Editor and changed the name of the Sheet to zero


It was>


Source = Excel.Workbook(Parameter1,null,true)

#"03_21_4_20_Sheet"=Source {[Item="03__21_4_20",Kind="Sheet"]}[Data],


I changed it to >


Source = Excel.Workbook(Parameter1,null,true)

#"03_21_4_20_Sheet"=Source {0}[Data],



Not applicable

If you are combining Excel Tables: All tables' names should be the same

If you are combining Excel Sheets: All sheets' names should be the same


As simple as that





Not applicable

In my case this error occured when one of the sheets was called differently

Frequent Visitor

I had this error today, and the solution was..... close the database - and all Access databases- that linked to my source file(s). SHAZZAMM! Fixed.

Frequent Visitor

1. First locate the error and find the problematic step,For me the error occurs in "Invoke Custom Function" step, and error is :"An error occurred in the ‘Transform File’ query. Expression.Error: The key didn't match any rows in the table."


2. Find the "Transform File" Function 

= (Parameter1) => let
        Source = Excel.Workbook(Parameter1, null, true),
        Sheet1_Sheet = Source{[Item="Sheet1",Kind="Sheet"]}[Data],
        #"Promoted Headers" = Table.PromoteHeaders(Sheet1_Sheet, [PromoteAllScalars=true])
        #"Promoted Headers"

This code is created according to the excel of the example, prompting other workbooks in our folder, should also be named “sheet1”


3.So, just rename all workbooks under the folder sheet's name to "sheet1", this problem can be solved.

Helper II
Helper II


one more thing that may resolve your problem. Close view in SQL you are trying to pull data from and give Power Bi a try.



Not applicable

Thanks, resolved my issue.

Frequent Visitor

For me this error was caused by bad login credentials.

New Member

I cannot get past this error.  It is when trying to update a Data Source for File Folder of CSV files.

First thought : i believe that Folder access works only for Excel files (xlsx not CSV extension)

If you send a link / Pbix i can have a look

Changing them to XLSX did not work either  😞


I just redid the query from the folder to take care of it.

Advocate III
Advocate III

@altomost - Thank you very much, that was exactly what I did and removing the Navigation fixed it.


It is a shame you can't import views from SQL Server, instead you have to import a table and then edit the query to act like a view. That was when I hit this error.



Not applicable

If you are using Tables/Views from SQL Server, check whether the power bi credentials have the permission to read from the table/view you have linked.

1. Go to "Options and settings" -> "Data source settings" -> "Edit Permissions" 

2. Capture.PNG

3. Cross check in the database whether this user role has the permission to access the table/view.

4. Go to SQL server

5. Right click on the table/view. Click "Poperties" ->Go to "Permissions".

6. Capture2.PNG

7. Add the user role/ give permission accordingly.

8. Go to Power BI and refresh.

Regular Visitor

I had a report connected to a folder and every month used to add new excel files in that folder to update the report. This happened when a new TAB in my new excel workbook had a different name than the old files connected to the report. So I just renamed the new tab in the new excel workbook to match the old tab in the old file excel files and it worked.


Hope it helps


Helpful resources

August 1 episode 9_no_dates 768x460.jpg

The Power BI Community Show

Watch the playback when Priya Sathy and Charles Webb discuss Datamarts! Kelly also shares Power BI Community updates.

Power BI Dev Camp Session 24 without aka link and time 768x460.jpg

Ted's Dev Camp - July 28, 2022

Watch Session 24 of Ted's Dev Camp along with past sessions!

Power Platform Conf 2022 768x460.jpg

Join us for Microsoft Power Platform Conference

The first Microsoft-sponsored Power Platform Conference is coming in September. 100+ speakers, 150+ sessions, and what's new and next for Power Platform.

Top Solution Authors
Top Kudoed Authors