Join us at FabCon Atlanta from March 16 - 20, 2026, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.
Register now!The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now! Learn more
I'm a little blocked trying to figure out how to make a web service call using what the user selected in a slicer as the value of a query parameter. As a simplified example, say my web service takes a single JSON product id (pid), and returns a single JSON value (price), transforms it to a table, and shows it in the UI. I can create a query that does:
let
selected_pid_value = "a",
url = "<myurl>",
body = Json.FromValue([pid = selected_pid_value]),
Source = Json.Document(Web.Contents(url,[Headers = [#"Content-Type"="application/json"], Content = body ] )),
#"Converted to Table" = Record.ToTable(Source)
in
#"Converted to Table"and this will work because I hard-coded the value for selected_pid_value. Now say I create a new table called "pid" using the following:
click: Enter Data
enter: a, b, c
type: Name: pid
click: LoadCreate a slicer for it, and lastly create a measure for it using:
pid_value = SELECTEDVALUE(pid[Value])Then, instead of hard-coding the value for selected_pid_value above, I use:
selected_pid_val = [pid_value],This gives me the following error:
Expression.Error: There is an unknown identifier. Did you use the [field] shorthand for a _[field] outside of an 'each' expression?
Solved! Go to Solution.
You may take a look at the post below.
Hi @roalexan ,
Were you able to pass the selected value from the slicer to the API call?
Stuck with the same issue.
Any help would be appreciated
Thanks
You may take a look at the post below.
The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now!
| User | Count |
|---|---|
| 40 | |
| 38 | |
| 36 | |
| 29 | |
| 28 |
| User | Count |
|---|---|
| 127 | |
| 88 | |
| 78 | |
| 66 | |
| 65 |