Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

A new Data Days event is coming soon! This time we’re going bigger than ever. Fabric, Power BI, SQL, AI and more. Don't miss out.

Reply
Anonymous
Not applicable

Create dynamic SQL server query

Hi Power BI Community,

 

I need your support with suggestions on how to create an SQL Query that can change dynamically based on selected options from the user. I found a guide that discusses this titled: Dynamic M Query Parameters in Power BI Desktop - Learn | Power BI, but the guide appears to be irrelevant since I cannot find the "bind to parameter" field in my Model view section.

 

What I need to do is receive a different set of values populated on my visuals based on a slicer. The slicer holds terms such as 2022/23, 2023/24 ... And by selecting one of the options, data in the query should be updated with records that match the selected term. How can I achieve this?

 

Thanks in advance for your support.

 

Cheers.

Screenshot 2024-03-08 113523.png

1 ACCEPTED SOLUTION
lbendlin
Super User
Super User

since I cannot find the "bind to parameter" field in my Model view section

Your data source needs to be in Direct Query Mode.  You need to have prepared a parameter for your query.  Then the "Bind"  option will be visible when you select the column to bind to and expand the Advanced section.

View solution in original post

2 REPLIES 2
Anonymous
Not applicable

Hi @Anonymous ,

 

@lbendlin  provided a great idea for the solution, the dynamic M query parameter gives the model author more control over the selection of filters to be incorporated into the DirectQuery source query. For more detailed information about query parameters and power bi templates, please refer to the documentation: Deep Dive into Query Parameters and Power BI Templates | Microsoft Power BI Blog | Microsoft Power B....

 

In addition, you can also use dax logic to generate a dynamic power bi slicer. For specific operation steps, please refer to the document: Dynamic Power BI Slicer Using DAX Logic (mssqltips.com).

 

If your Current Period does not refer to this, please clarify in a follow-up reply.

 

Best Regards,

Clara Gong

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

lbendlin
Super User
Super User

since I cannot find the "bind to parameter" field in my Model view section

Your data source needs to be in Direct Query Mode.  You need to have prepared a parameter for your query.  Then the "Bind"  option will be visible when you select the column to bind to and expand the Advanced section.

Helpful resources

Announcements
May Power BI Update Carousel

Power BI Monthly Update - May 2026

Check out the May 2026 Power BI update to learn about new features.

Fabric SQL PBI Data Days

Data Days 2026 coming soon!

Sign up to receive a private message when registration opens and key events begin.

New to Fabric survey Carousel

New to Fabric Survey

If you have recently started exploring Fabric, we'd love to hear how it's going. Your feedback can help with product improvements.

Power BI DataViz World Championships carousel

Power BI DataViz World Championships - June 2026

A new Power BI DataViz World Championship is coming this June! Don't miss out on submitting your entry.