Forum Discussion
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.
Ran into this issue myself within the Power BI Desktop and was able to resolve the issue through the following:
- Select Edit Queries from the menu to open the Query Editor
- Use the left hand menu to select one of the queries having the issue (will have the triangular warning sign)
- On the applied steps menu at the right select the source step.
- 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 -
45 Replies
- tonysellars
Advocate II
Ran into this issue myself within the Power BI Desktop and was able to resolve the issue through the following:
- Select Edit Queries from the menu to open the Query Editor
- Use the left hand menu to select one of the queries having the issue (will have the triangular warning sign)
- On the applied steps menu at the right select the source step.
- 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 -
- Florent-Shawns
Advocate I
Hi Tony,
I have the same error but I am using power query in Excel. I am using a personal gateway, here is my error message below:
- carvalho27New Member
Nothing changed - 1 day it worked - the next day refresh bombed with this message
The refresh preview approach did not resolve the issue for me.
I created new connections to the same data source and then used Advanced Edit to copy the new connection strings to my original tables.
Has Microsoft acknowledged this is a PowerBI Desktop issue ?Anybody understand the root cause ?
- AnonymousNot 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:
Know how to fix this?
Thx in advance.
Cheers,
Andrea
- tonysellars
Advocate II
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.
Hope this helps.
- jhansjrNew 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.
- manojshethNew 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.
- mustafayNew Member
Hi,
I got same error, in my case excel sheet names were different. After changing to same name the problem solved.
Mustafa Yalcin
- Jmenas
Advocate III
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.
- joshcomputer1
Helper V
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?
- AnonymousNot applicable
Yes, I had the same problem and following your suggestion really helped me.
Thanks!
- MamerionFrequent Visitor
Hi All,
I'm connecting to a data source on SQL server and faced the same "key didn't match" issue. tried all suggestions from community and almost anything from net, but none has worked for me.
After 7 hours of research and trial and error, I discovered something related to my credential on SQL server that was causing this issue. I'm not sure why the "db_owner" was unticked!(might be due to the patching updates on the server) I checked the box then refreshed the report and now it is working as normal.
In SQL management Studio, navigate to the Databases\[database name]\Security\Users\ and double click on the userID to open the "Database User" window, then select the "membership" from the left side of the window.
I am the dabase owner so the db_owner is ticked, if you are not an owner, then make sure that at least the "db_datareader" is checked.
Hoping it helps you to save heaps of troubleshooting time.
Regards,
M
- ThomVF
Advocate IV
I just wanted to thank you for your post. It helped me solve my issue.
I have my gateway configured to use a specific user on my SQL Server database. This user did not have db_owner set. Once I set that, my refreshes started working fine. I was thrown off bc the refreshes were working from Power BI Desktop but not in the Service.
Of course, these errors are so cryptic, you could spend a whole week trying to figure out what the heck they mean.
Anyhow, you saved me a lot of time and I thank you.
- MamerionFrequent Visitor
Good to hear that it helped you to resolve the issue :)
- pooyanRegular Visitor
Thanks a lot! it did help me
- patlaffFrequent 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.
- patlaffFrequent 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.
- manojshethNew 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.
- mustafayNew Member
Hi,
I got same error, in my case excel sheet names were different. After changing to same name the problem solved.
- DBMRegular Visitor
Here's what worked for me:
- Have your replacement source file (e.g. excel file) ready to go. Make sure the file name and sheet names are the same.
- Then in PBI, in the Fields panel, right-click on the troublesome field. Delete it. The graph it populates will be replaced by a placehoulder saying "Something's wrong with one or more fields. Fix This". DON'T DO ANYTHING to the graph at this point.
- Instead, imediately click on Get Data. Select the new file and in a moment or two your graph should re-populate with the new data, and even retain the original formatting (e.g. colors, etc.). Hope this works for you.
- erik--Frequent Visitor
I ran into this error and learned that the navigation step in the query was referring to a SQL table and that the table name was case significant. I had changed the database table from "sales" to "Sales" and ran into the thread title error both from PowerBI on my desktop and PowerBI web service. I capitalized the table name in the navigation step and everything went back to working as it previously was. Different cause, but wanted to share my experience and fix.
- AnonymousNot applicable
Again, a different cause - similar to Erik's post -the user's permissions were accidentally altered on a SQL Server database so that the table was no longer available (ie no SELECT was granted) and the error will occur. Can reproduce error (SQL 2014 and 2016). So check your table permissions just in case something has changed.
- erik--Frequent Visitor
I ran into this error and learned that the navigation step was referring to a SQL table and that the table name was case significant. I had changed the database table from "sales" to "Sales" and ran into the thread title error both from PowerBI on my desktop and PowerBI web service. I capitalized the table name in the navigation step and everything went back to working as it previously was.