Forum Discussion
Error returned: 'OLE DB or ODBC error: [Expression Error] The key didn't match any rows in the table
- Anonymous5 years ago
Anonymous
A typical case would be when you connect to an datasource and your Query attempts to access a table or column that does not exist in your datasource. Check if there is any table/column names are not matching.Reference:
Paul Zheng _ Community Support Team
If this post helps, please Accept it as the solution to help the other members find it more quickly.
This happened to me when added a line in transform file to combine files under the same sheet name.
I was getting the error as some of my sheets didnt have a matching sheet name so it returned a error.
To fix this you need to do is add a safety check so Power Query doesn’t try to grab a sheet that isn’t there.
replace Page_Sheet = Source{[Item="Page",Kind="Sheet"]}[Data]
with
FilteredSheets = Table.SelectRows(Source, each [Item] = "Page" and [Kind] = "Sheet"),
Page_Sheet = if Table.RowCount(FilteredSheets) > 0
then FilteredSheets{0}[Data]
else #table({}, {}), (empty table if no match)
Should fix your problem
This solution worked on one of my PBI files with this error, but not others. Very nice idea!