Forum Discussion
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
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.
1 Reply
- v-yuta-msftCommunity Support
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.