Join us for an expert-led overview of the tools and concepts you'll need to pass exam PL-300. The first session starts on June 11th. See you there!
Get registeredPower BI is turning 10! Let’s celebrate together with dataviz contests, interactive sessions, and giveaways. Register now.
I am running into this error of key didn't match to any rows in the table when I try to query from snowflake.
I am able to run the same query in snowflake without any issue.
All the details such as Warehouse, Schema, name, Table name are passed as it's present in Snowflake and has the necessary permission to database as well. Appreciate you help in this!
SELECT count(*)
FROM PUBLIC.USERS u
WHERE u.IS_ACTIVE = TRUE
AND u.USER_TYPE !='VIEWER'
@Gagana - Start by clearing your data source credentials in Power BI, if this doesnt work, you'll need to check the settings of your datasource.
If I answered your question please mark my post as the solution, it helps others with the same challenge find the answer!
Hi @mark_endicott
It's the same error after clearing the DS credentials. But without query, I'm able to load the tables.
Ok then next thing to check and amend is the fact that you haven't aliased your query correctly. Snowflake (and most Power Query connectors) expect your SQL to be enclosed in parentheses and given an alias.
Try something along the lines of:
SELECT count(*) as "count of users"
FROM PUBLIC.USERS u
WHERE u.IS_ACTIVE = TRUE
AND u.USER_TYPE !='VIEWER'
If this still fails, here are other things to check:
Native query is disabled in your Power BI settings
In Power BI Desktop go to File → Options → Preview Features (or Options & settings → Query reduction in newer builds) and ensure Allow native database queries is turned on. If it’s off, Power BI won’t send your SQL at all.
Case-sensitivity / quoting mismatches
Snowflake defaults to uppercase unquoted identifiers. If you reference "myColumn"
(mixed- or lowercase) without quotes, or vice versa, you can confuse the connector’s key lookup. Double-check your column and alias casing.
You haven’t specified the right database/schema context
When you supply a native query, Power BI doesn’t automatically prepend your Snowflake database and schema. Either:
Fully qualify your objects in the SQL (e.g. FROM MYDB.MYSCHEMA.MYTABLE
), or
In the connector dialog, set Warehouse, Database and Schema explicitly before pasting your SQL.
Permission / role issues
The Snowflake user or role you’re using must have SELECT privileges on any tables/views in your query. Even if Import mode works (because it pulled cached data), DirectQuery or native SQL needs live metadata access.
Out-of-date ODBC driver or connector version
Older Snowflake ODBC drivers or Power BI Snowflake connectors have had bugs around native SQL support.
Update your Snowflake ODBC driver to the latest
Ensure your Power BI Desktop is up-to-date
Privacy level conflicts
If your source is marked as “Private” under File → Options → Privacy, Power BI may sandbox the query. Try temporarily setting it to “Organizational” or “None” to see if the error disappears.
Check the Power Query steps & parameter bindings
If you’ve wrapped your native SQL in parameters or further M-steps, you may inadvertently break the link between the native query step and the preview metadata. In the Applied Steps pane, make sure the Source or NativeQuery step points directly to your wrapped-and-aliased SQL.
If I answered your question please mark my post as the solution, it helps others with the same challenge find the answer!
User | Count |
---|---|
84 | |
79 | |
71 | |
47 | |
42 |
User | Count |
---|---|
109 | |
54 | |
50 | |
40 | |
40 |