Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

The ultimate Microsoft Fabric, Power BI, Azure AI & SQL learning event! Join us in Las Vegas from March 26-28, 2024. Use code MSCUST for a $100 discount. Register Now

Reply
kcantor
Community Champion
Community Champion

Expression.Error: The key did not match any rows in the table

I have a data set that has refreshed successfully in the past. It was built 3 days ago and refreshed fine for two days. Now I cannot refresh it either on the desktop version or from services. The error reads Expression.Error: The key didn't match any rows int he table. Other tables return the error message Load was cancelled by an error in loading a previous table. I tried to delete the problematic table from the data set with plans to re add it later. When I deleted the problem table, a second table threw the same error. I removed it too and a third then erred.  It is a domino effect. All tables are failing one at a time. The tables, however, are fine. I can use them in other documents and in PowerPivot. any ideas?

A coworker updated her version and the gateway and is getting the same error. This was built in a group and resides in the group folder.





Did I answer your question? Mark my post as a solution!

Proud to be a Super User!




1 ACCEPTED SOLUTION
tonysellars
Advocate II
Advocate II

Ran into this issue myself within the Power BI Desktop and was able to resolve the issue through the following:

 

  1. Select Edit Queries from the menu to open the Query Editor
  2. Use the left hand menu to select one of the queries having the issue (will have the triangular warning sign)
  3. On the applied steps menu at the right select the source step.
  4. In the top menu bar, select Refresh Preview.

In my case there were several queries having this same issues and the steps above resolved each of them.

 

Hope this helps -

View solution in original post

44 REPLIES 44
Anonymous
Not applicable

Yes, I had the same problem and following your suggestion really helped me.

 

Thanks!

Hi All,

 

It might be resolved but if anyone had this problem with googla Anyltics API.

 

I found that the solution is to add a custom column and transform the query into a normal table. Otherwise power bi service, in my case, will no identify the correct table. 

 

 

Best,

J.

I am using power bi that has a dataset of multiple excel spreadsheets (tables) on sharepoint. I had no problems with refresh until....I had to add an additional table to the power query.  I have two issues here...(1. how to fix the refresh 2. how to prevent this from happening as the dataset changes). 

 

 

1. I get this error and I have followed the steps to resolve.  When I use the desktop app, I hit refresh and everything works fine. It updates without error. When I go to "edit query" to see if there are errors, there are no errors.  All I am going off of is the email I get that says the refresh failed.  How can I narrow it down if there aren't errors?  Is this error occurring for a specific table that I can isolate?

 

2. What caused this=>  I added a table and created a power query in excel.  When I appended the query to my existing query, what it does is creates a new tab with it appended.  The only problem is that I have the dataset source pointing to the table "master" and now I have a table that is called "appended1".  I have other tabs pointing to a tab called master and now I need to change the reference to appended1.  It seems like I did something wrong with power query, so I went back through that process and tried other options when appending and still got the same result. I see myself having to fix this everytime a new tab is created. How can be more effective with this process?

mustafay
New Member

Hi, 

I got same error, in my case excel sheet names were different. After changing to same name the problem solved. 

manojsheth
New Member

I faced this issue when I changed my schema/authentication credentials. (I was connecting to same database instance - but was connecting to different schemas/username-passwords). 

 

In effect I was connecting to a instance with an user which did not have permission to query the original object saved in the query.

 

Once I updated the user in (Query-> Edit -> Data Source Settings, it refreshed for me.

 

 

manojsheth
New Member

I faced this issue when I changed my schema/authentication credentials. (I was connecting to same database instance - but was connecting to different schemas/username-passwords). 

 

In effect I was connecting to a instance with an user which did not have permission to query the original object saved in the query.

 

Once I updated the user in (Query-> Edit -> Data Source Settings, it refreshed for me.

 

 

patlaff
Frequent Visitor

Not sure if this will help everyone, but I received this error because I had not yet given permissions to the SQL account for the new database I was trying to connect to. Make sure the account you're using has at least read permissions, otherwise this error will be thrown.

patlaff
Frequent Visitor

Not sure if this will help everyone, but I received this error because I had not yet given permissions to the SQL account for the new database I was trying to connect to. Make sure the account you're using has at least read permissions, otherwise this error will be thrown.

jhansjr
New Member

I have noticed this problem when saving a workbook at work, then using a synched version of the same workbook at home and vice-versa (different computers). In my case my workbook contained several queries from sharepoint sources. All of them indicated the same error upon opening the workbook at a different location, even though the sharepoint url pointing to my data sources should have worked just fine. 

 

I tried the Tony's solution offered here and that worked fine. But I felt having to open and refresh each of my queries one-by-one everyday was bound to become irritatingly cumbersome, especially since some of my workbooks pull 10 or more sources. 

 

I found an alternate solution that worked for me. 

 

1. Go to the DATA tab in Excel and click on the Connections icon. 

2. Find the connected query(ies) that are having the error

3. Click on the Properties button to the right. 

4. Under the first section called "Refresh control", check the box labled "Refresh data when opening the file"

 

You may have to experiment with how this affects your individual performance but for me it solved the error issue. 

 

tonysellars
Advocate II
Advocate II

Ran into this issue myself within the Power BI Desktop and was able to resolve the issue through the following:

 

  1. Select Edit Queries from the menu to open the Query Editor
  2. Use the left hand menu to select one of the queries having the issue (will have the triangular warning sign)
  3. On the applied steps menu at the right select the source step.
  4. In the top menu bar, select Refresh Preview.

In my case there were several queries having this same issues and the steps above resolved each of them.

 

Hope this helps -

Thanks for providing a solution! I've tried this as well but I have an issue where the data takes a very long time to load. This is because the table is a reference table from a RaaS API connection. Do you know if this is the reason the key did not match any rows in the table or am I dealing with a different beast?

Awesome .. thanks for Quick Solution

Awesome, it worked for, me as well! Thanks a lot😃

Thanks! This fixed the problem for me!

Anonymous
Not applicable

My fix was slightly different.  I needed to update the db tables and my credentials, but this solution got me 90% there.  

Anonymous
Not applicable

Hello @tonysellars,

 

I had same issue and with your trick I manged to fix it.

 

However, in the next steps of the query i got the following message:

 

2017-02-03 15_25_53-Monthly Report TEST_V2 - Query Editor.png

 

Know how to fix this?

 

Thx in advance.

 

Cheers,

Andrea

Remove Navigation step, as it attempts to read full table from DB and that does not match with your source querry

The query itself contains a lot of metadata related to the source you are pulling from and it seems that this can get a bit out of whack.  The case you are looking at here you have a many different steps you are going through.  The issues for this error have typically been in the source step.  To see all the steps and see how the query progresses you can take a look at the progression as each step generates a result which is operated agaist by the next step.  The original trick to refresh the query, has worked for me and I was glad to see that it seemed to work with Power Query as well as it uses basically the same mechanism.  If you do continue to get an error even after refresh, take a look at the advanced editor and see if something jumps out as not being in sync with your source in one of the later steps.

 

AdvancedEditor.png

 

Hope this helps.

This did not work for me either.  I connected to a database, then copied some views into that db.  PowerBi keeps giving me the message about keys not matching.  

 

I've gone into each view to change the source to the new db and then hit refresh but i still get the message of keys not matching.  Any suggestions?

This issue happened to me and it is because whenever I download the raw data from Salesforce it gives the worksheet within the xlsx file a different name. I have to go into each query and update the worksheet name under 'navigation'. This problem has only occured for me since importing xls files rather than csv, might just go back to using csv's

I also had this problem and the reason is that every time I download the raw data from salesforce, the worksheet is given a different name, so the worksheet name needs to be updated in each query under 'navigation'. I have only had this issue since importing xls files rather than csv's, so might just go back to csv's.

Helpful resources

Announcements
Fabric Community Conference

Microsoft Fabric Community Conference

Join us at our first-ever Microsoft Fabric Community Conference, March 26-28, 2024 in Las Vegas with 100+ sessions by community experts and Microsoft engineering.

Fabric Career Hub

Microsoft Fabric Career Hub

Explore career paths and learn resources in Fabric.

Fabric Partner Community

Microsoft Fabric Partner Community

Engage with the Fabric engineering team, hear of product updates, business opportunities, and resources in the Fabric Partner Community.

Power BI Header Change

Power BI Header Update

Read about the exciting updates for the Power BI forum.

Top Solution Authors
Top Kudoed Authors
Users online (1,003)