Supplies are limited. Contact info@espc.tech right away to save your spot before the conference sells out.
Get your discountScore big with last-minute savings on the final tickets to FabCon Vienna. Secure your discount
Hi there
I have successfully used parameter binding on selected Values when the values are selected through a slicer on a 'hand-made' parameter table. The parameters are passed to the SQL query (direct query mode) where I insert the the bound parameter into the SQL-Query.
What I am trying to achieve now puzzles me: I have a FIELD PARAMETER slicer & table. Meaning I created a field parameter, where the user may select the column by which to visualize the bar chart. Let's say the values are Sales in $ and the columns to choose from are by Brand, Country or "Brand Partner Status".
I am not able to pass the selected Column in the Field Parameter Slicer to the SQL query.
Does anybody know how to achieve this?
Solved! Go to Solution.
Hi @Que_Ry_Sa
Passing a dynamic Field Parameter to a native SQL query isn't straightforward because SQL expects fixed column references, while Field Parameters are evaluated at runtime on the Power BI side.
Unfortunately, Field Parameters can't directly influence the structure of a SQL query, because M/Power Query (and SQL behind it) doesn't interpret dynamic column names from slicers or field parameters the way a DAX visual would.
Here’s a possible approach you can try (I've used this successfully in similar setups):
SelectedCol = SELECTEDVALUE(ParamTable[Param Field])
SELECT
CASE WHEN @SelectedColumn = 'Brand' THEN Brand
WHEN @SelectedColumn = 'Country' THEN Country
WHEN @SelectedColumn = 'PartnerStatus' THEN [Brand Partner Status]
END AS DynamicColumn
FROM SalesTable
Hi @Que_Ry_Sa ,
Since we didnt hear back, we would be closing this thread.
If you need any assistance, feel free to reach out by creating a new post.
Thank you for using Microsoft Community Forum
Hi @Que_Ry_Sa ,
Just wanted to check if you got a chance to review the suggestions provided and whether that helped you resolve your query?
Thank You
Hi @Que_Ry_Sa ,
Just wanted to check if you got a achance to review the suggestions provided and whether that helped you resolve your query?
Thank You
Selected values from field parameters can't be passed into M SQL queries. While M influences the semantic model, anything done in the report designer stays within the designer - it doesn't flow back into the query layer. Only parameter values in the query editor can be passed on to a M SQL query.
Hi @Que_Ry_Sa
Passing a dynamic Field Parameter to a native SQL query isn't straightforward because SQL expects fixed column references, while Field Parameters are evaluated at runtime on the Power BI side.
Unfortunately, Field Parameters can't directly influence the structure of a SQL query, because M/Power Query (and SQL behind it) doesn't interpret dynamic column names from slicers or field parameters the way a DAX visual would.
Here’s a possible approach you can try (I've used this successfully in similar setups):
SelectedCol = SELECTEDVALUE(ParamTable[Param Field])
SELECT
CASE WHEN @SelectedColumn = 'Brand' THEN Brand
WHEN @SelectedColumn = 'Country' THEN Country
WHEN @SelectedColumn = 'PartnerStatus' THEN [Brand Partner Status]
END AS DynamicColumn
FROM SalesTable