- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content

User input for dynamic SQL Queries in Power BI desktop?
Hello
We have a SQL query in a Power BI Desktop file, and this query selects from a database function. The function accepts an input. We would like to allow users to set this input through a visual element, such as a slicer.
The first thought came to mind was to use parameter as I had read it somewhere before.
A similar question was asked a few years back in the following thread.
It did not sound like it was possible in Power BI Desktop.
A few years have passed, and I wonder if it is possible or not to make a SQL query dynamic by allowing user to select an input as the condition for the query?
Thank you.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content

Hi @Andy__
If your data source is SQL Server, you can consider to use direct mode to connect to the data source, then set the paramater in power query , it can be edit in Power BI Desktop so that you can implement that filter the database dynamically, you can refer to the following link about how to set the paramater.
Dynamic M query parameters in Power BI Desktop - Power BI | Microsoft Learn
Unlock the power of dynamic parameter binding for ... - Microsoft Fabric Community
Best Regards!
Yolo Zhu
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content

Hello Yolo,
Thanks for your information. Somehow it did not work for me. I am using Power BI Desktop May 2021, if that makes a difference.
Here were what I did.
- Created a new Power BI file.
- Selected SQL Server as data source and selected Direct Query.
- Entered the SQL select statement in the query dialog.
- Went to the query editor to create a parameter.
- Edited the query in the Advanced Editor, which appears to have converted the regular SQL statement to the M language. I was able modify it to use the parameter.
- Went back to Power BI desktop to create a table under the Modeling ribbon. But the New Table option is greyed out. Therefore it appears it does not work for me.
Best regards
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content

Hi @Andy__
After testing, if your connection mode is direct query, the create new table can be used, try to clear permission and reconnect the sql again.
Best Regards!
Yolo Zhu
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content

Hello Yolo,
I created a new file to do the experiement, and I did not save it. Therefore I cannot clear the permission to check whether it works or not. However, when I went back to the existing file, I found that the create new table option is available.
However, the "Bind to parameter" option is not available!
When I looked around and when I looked back at one of your reference links, Dynamic M query parameters in Power BI Desktop - Power BI | Microsoft Learn
I found under "considerations and limitations" that:
"
- Dynamic M query parameters are not supported on Power BI Report Server.
"
And we are using Power BI Report Server.
Best regards

Helpful resources
Join us at the Microsoft Fabric Community Conference
March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount!
Power BI Monthly Update - February 2025
Check out the February 2025 Power BI update to learn about new features.

Subject | Author | Posted | |
---|---|---|---|
07-29-2024 08:01 AM | |||
01-02-2024 07:28 AM | |||
10-18-2023 02:59 AM | |||
05-27-2024 04:23 PM | |||
12-20-2023 07:02 AM |
User | Count |
---|---|
83 | |
80 | |
46 | |
38 | |
37 |