27 Sep Error when loading a new query – OLE DB or ODBC error 10 keys were specified, but 5 values were provided
OLE DB or ODBC error: [Expression Error] NN keys were specified, but N values were provided.
I recently had an issue in Power BI when trying to add in an additional query. The screenshot of the error message is displayed below.
The error isn’t hugely helpful, and it took a long time to resolve it. In the end it turned out to be an issue with the date table, in my case it was because I was using the following formula to create the date table.
VAR MinYear = 2019
VAR MaxYear = 2025
AND ( YEAR ( [Date] ) >= MinYear, YEAR ( [Date] ) <= MaxYear )
I changed the code to the following, removing the CALENDARAUTO() code, and replaced it with the following…
VAR MaxYear = YEAR(TODAY()) + 1
Whilst the code is not functionally the exact same, it works for my customer (and is better IMHO), and very importantly, removed the error.