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.
Hello Power BI Community,
I am trying to import data in Power BI from a Snowflake database.
Since the Snowflake connector doesn't allow to pass SQL statements, I am using a ODBC connector to pass my SQL scripts.
As soon as I don't use variables, it's working well but when I enter SQL scripts with variables like below :
I am getting the below error :
Has anyone encountered the same issue ?
Thank you,
Arnaud
Solved! Go to Solution.
Hi @Anonymous ,
The parameter can't be directly used in sql statement window, you need to modify it in anvanced editor. Please refer to Use Case 2: Loading Dynamic Columns from the Data Source in https://www.biinsight.com/power-bi-desktop-query-parameters-part-1/
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Best Regards,
Dedmon Dai
Hi @Anonymous ,
Would you please try something like :
Odbc.Query("dsn=xxxx", "Select * from xxxxx where xxxxx="&Parameter&"")
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Best Regards,
Dedmon Dai
Hello @v-deddai1-msft , thanks, I think it could work as a workaround but to make it simple, I would like to declare and use variables directly in the SQL statement
Hi @Anonymous ,
The parameter can't be directly used in sql statement window, you need to modify it in anvanced editor. Please refer to Use Case 2: Loading Dynamic Columns from the Data Source in https://www.biinsight.com/power-bi-desktop-query-parameters-part-1/
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Best Regards,
Dedmon Dai
Thank you!!
@Anonymous , I think you should pass the parameter like
https://powerbi.microsoft.com/en-us/blog/deep-dive-into-query-parameters-and-power-bi-templates/
Hi @amitchandak . Thanks but I can't use this option. The script I want to use has 12 joins on massive tables with parameters dependancies and importing those massive tables would not be possible so I really need to include parameters in the SQL statement and so import 1 single table in Power BI
Hi @Anonymous - Were you able to solve? We have similar requirement re massive table joins that need parameter driven filtering. Was thinking would be able to inject filter parameters via advanced editor as implied in above discussion.
User | Count |
---|---|
84 | |
76 | |
74 | |
49 | |
39 |
User | Count |
---|---|
114 | |
56 | |
51 | |
42 | |
42 |