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

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now! Learn more

Reply
MarkDenHeijer
Frequent Visitor

M query Selected value

Hi, 

 

I'm rather new to PowerBI. I have searched the community but didn't find a satifying answer there, so I'll give it a shot to see if someone can help me. 

 

I want to achieve the following: 

I have a report with a table on one of the pages. I can drillthrough from there to the next page from there, showing details of the selected record. Because some of the details is large data (base64 strings), I want to call a datasource of type direct query (import is not an option), using the ID of the selected value as input for the query. (table valued sql function) . 

 

The big question is how do I get the selected value and pass in onto the input for my direct query. 

 

Some of my thoughts: 

1: create a hidden table visual which contains only one row at a time, containing the ID value that I need. Use M functions like Table.First / Record.Field to get the selected value. But I can't figure out the right syntax.

2: Set a parameter based on the selection and use that parameter in the direct query. But setting a parameter with the selected value doesn't seem to be possible???

 

If anyone has a brilliant idea to get this to work, please let me know how to do this. 

 

Thanx in advance!

 

kind regards, Mark

1 ACCEPTED SOLUTION
v-yuta-msft
Community Support
Community Support

@MarkDenHeijer ,

 

You couldn't use the selected value in a visual(e.g.: slicer) as a parameter. As a workaround, in query editor, you can create query parameter and configure a list of values(parameters you need) previously. For mode details, I would suggest you refer to doc below:

https://docs.microsoft.com/en-us/power-query/power-query-query-parameters

https://powerbi.microsoft.com/en-us/blog/deep-dive-into-query-parameters-and-power-bi-templates/

https://www.biinsight.com/power-bi-desktop-query-parameters-part-1/

 

Community Support Team _ Jimmy Tao

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

1 REPLY 1
v-yuta-msft
Community Support
Community Support

@MarkDenHeijer ,

 

You couldn't use the selected value in a visual(e.g.: slicer) as a parameter. As a workaround, in query editor, you can create query parameter and configure a list of values(parameters you need) previously. For mode details, I would suggest you refer to doc below:

https://docs.microsoft.com/en-us/power-query/power-query-query-parameters

https://powerbi.microsoft.com/en-us/blog/deep-dive-into-query-parameters-and-power-bi-templates/

https://www.biinsight.com/power-bi-desktop-query-parameters-part-1/

 

Community Support Team _ Jimmy Tao

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

 

Helpful resources

Announcements
Power BI DataViz World Championships

Power BI Dataviz World Championships

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now!

December 2025 Power BI Update Carousel

Power BI Monthly Update - December 2025

Check out the December 2025 Power BI Holiday Recap!

FabCon Atlanta 2026 carousel

FabCon Atlanta 2026

Join us at FabCon Atlanta, March 16-20, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.