Forum Discussion
Dynamic Query Parameters in SQL query.
Yes, this can be done. You need to start with a Direct Query data source. Investigate "Query Parameters" in Power BI.
Create a basic Parameter in Power Query.
Edit the Advanced Query of your main SQL statement to inject that Parameter into the SELECT statement, much like you have done in your post.
On the Home tab. click Enter Data and create a table that will hold the valid values of the paramter.
Now, in the Model view, for the table you just entered, under the Advanced options, "Bind to parameter" and select the Power Query parameter.
Hope that helps.
Microsoft introduced this a few years ago.
- rnola161 year agoAdvocate II
Really appreciate your quick inputs Todd. The paramaters I use are the fields from a databse table ( eg: case_id which runs into billion records) So in this case I cannot create a table and list the values to be used in parameter, the values of it are user inputs ( something like a prompt when the user runs the query)