Find everything you need to get certified on Fabric—skills challenges, live sessions, exam prep, role guidance, and a 50 percent discount on exams.
Get startedEarn a 50% discount on the DP-600 certification exam by completing the Fabric 30 Days to Learn It challenge.
I have a slicer, and I want to get the multiple values selected in the slicer in the M query, to call an API with a filter as per the selected values.
For testing purposes, I'm using sample data to load the slicer and using a measure to append the selected values into a string as below:
I want to get the selected values in my M query, from where I'm calling the API.
let
// Define the base URL of the API
baseURL = "https://api.example.com/data",
// Define the OData filter
odataFilter = "?$filter=Name in ('John','Sam')",
// Construct the full URL with the OData filter
fullURL = baseURL & odataFilter,
// Call the API
apiResponse = Web.Contents(fullURL),
// Convert the response to JSON
jsonResponse = Json.Document(apiResponse),
// Convert the JSON response to a table (if applicable)
// Replace "Record.FieldValues" with the appropriate function to extract data from your JSON response
dataTable = Table.FromRecords({Record.FieldValues(jsonResponse)})
in
dataTable
Solved! Go to Solution.
@dixanthomass , I doubt you can get the selected value in M, unless we use the dynamic M parameter
https://blog.crossjoin.co.uk/2020/10/25/why-im-excited-about-dynamic-m-parameters-in-power-bi/
Hi @dixanthomass ,
Can I ask if your problem has been resolved? If it has been resolved, could you please mark useful replies as ‘Answered’? This will help others in the community to easily find a solution if they are experiencing the same problem as you. Thanks.
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.
@dixanthomass , I doubt you can get the selected value in M, unless we use the dynamic M parameter
https://blog.crossjoin.co.uk/2020/10/25/why-im-excited-about-dynamic-m-parameters-in-power-bi/