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

Power BI is turning 10! Let’s celebrate together with dataviz contests, interactive sessions, and giveaways. Register now.

Reply
coletta625
Regular Visitor

Power BI - Bind column to Parameter

 I created a parameter with values tied to another table called SortBy which holds the valid list of parameters.

coletta625_0-1734102149257.png

 

 

I have a slicer on the canvas tied to Sort Value

coletta625_2-1734102149374.png

 

No action is taken when I select a value from that slicer.  

I've been reading about binding a field to a parameter, but I do not have that option in my Desktop version modeling - advanced settings nor do I see in Power BI service editor.

 

Field parameters as a Preview Feature is checked in Options.

 

How can I expose the parameter the user so they can dynamically select a value that will refresh the visual with the correct passed parameter?

1 ACCEPTED SOLUTION
Anonymous
Not applicable

Hi @coletta625 ,

According to your description, you want to do dynamic m-parameter binding for sql queries in power bi desktop.
First, you need to make sure that you are connecting to sql as a direct query.

vheqmsft_0-1734313407281.png


Secondly, create a new parameter in power query.

vheqmsft_1-1734313453099.png

vheqmsft_2-1734313478959.png

 


Again, open the advanced editor and replace the parameter with the reference where it needs to be changed dynamically.

vheqmsft_3-1734313619363.png


Then, go back to the power bi desktop and create a parameter table and bind it to the m parameter.

Table = 
{
    "data_refreshTest",
    "data_refreshTest_2",
    "data_refreshTest_3"
}

vheqmsft_4-1734313661396.png

vheqmsft_5-1734313720629.png


Finally, create a slicer with the data from the new table so that you can make dynamic parameter change.

vheqmsft_6-1734313750468.png

vheqmsft_7-1734313760274.png

 

Dynamic M query parameters in Power BI Desktop - Power BI | Microsoft Learn

 

Best regards,
Albert He


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

 

 

View solution in original post

4 REPLIES 4
Anonymous
Not applicable

Hi @coletta625 ,

According to your description, you want to do dynamic m-parameter binding for sql queries in power bi desktop.
First, you need to make sure that you are connecting to sql as a direct query.

vheqmsft_0-1734313407281.png


Secondly, create a new parameter in power query.

vheqmsft_1-1734313453099.png

vheqmsft_2-1734313478959.png

 


Again, open the advanced editor and replace the parameter with the reference where it needs to be changed dynamically.

vheqmsft_3-1734313619363.png


Then, go back to the power bi desktop and create a parameter table and bind it to the m parameter.

Table = 
{
    "data_refreshTest",
    "data_refreshTest_2",
    "data_refreshTest_3"
}

vheqmsft_4-1734313661396.png

vheqmsft_5-1734313720629.png


Finally, create a slicer with the data from the new table so that you can make dynamic parameter change.

vheqmsft_6-1734313750468.png

vheqmsft_7-1734313760274.png

 

Dynamic M query parameters in Power BI Desktop - Power BI | Microsoft Learn

 

Best regards,
Albert He


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

 

 

Does this not work with a stored procedure then?

It has to be a query or a view, it can't use parameters that are bound with stored procedures?

bchager
Super User
Super User

@coletta625 Are you referencing the parameter value in a measure that's used for your visualization?

 

I can't use a measure because the ultimate goal of this parameter is to pass to a SQL Stored Procedure in Power Query like this:

Let

Source = Sql.Database("jobboss", "ems_Sql", [Query="EXEC sp_usr_ShopTracker '" & SelectedParameter & "'"

 

I can't use a calculated column because that cannot hold the SELECTEDVALUE of a slicer.  I've even tried creating a manual table to hold a value to pass, but I cannot figure out a way to allow the user to change this value.

coletta625_0-1734104496575.png

let
    SelectedParameter = Table.FirstValue(ParamTable),
    Source = Sql.Database("jobboss", "ems_Sql", [Query="
EXEC sp_usr_ShopTracker '" & SelectedParameter & "'"

 

Short of creating 9 queries and visuals with a hardcoded parameter value, I am out of ideas.

Helpful resources

Announcements
June 2025 Power BI Update Carousel

Power BI Monthly Update - June 2025

Check out the June 2025 Power BI update to learn about new features.

June 2025 community update carousel

Fabric Community Update - June 2025

Find out what's new and trending in the Fabric community.