Forum Discussion
Dynamically control the Rest API URL for datasource "from Web" based on user input/interaction
- 5 years ago
Hi Panto ,
Do you want to use filters or slicers to set the value(s) for an query parameter? You can refer to the preview function: https://docs.microsoft.com/en-us/power-bi/connect-data/desktop-dynamic-m-query-parameters.
Since it is a preview version, so it has many limitations and may not have good technical support.
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Best Regards,
Dedmon Dai
Hi Panto
You can create a Parameter from the Manage Parameters icon in the PQ menu.
This will allow you to specify a parameter/value that can be added to the URL. As this parameter value is changed so the data returned by your Web request changes.
Here's a sample PBIX file demonstrating the procedure below.
For example click on Manage Parameters and then New Parameter
Fill in the details for the new parameter
After you click OK you will have a new parameter called StudentID listed under the queries on the left of the screen and you should see this
Now open your main query in the Advanced Editor, the source step should look something like this
Source = Web.BrowserContents("https://www.api.com/employee/")
Change it so it looks like this
Source = Web.BrowserContents("https://www.api.com/employee/"&Text.From(StudentID)),
Close the query and then click on the StudentID parameter query.
Change the value of the parameter, then click back on the main query. It should load the data associated with the Student ID you just entered as the parameter value.
Regards
Phil
If I answered your question please mark my post as the solution.
If my answer helped solve your problem, give it a kudos by clicking on the Thumbs Up.
Hi Philip,
thanks for your feedback.
I've already tried somethig similar and since I cannot download your sample pbix, let me add one additional info.
"After" Power BI Dekstop, what I need is something that once published on PBI service may allow the final user of the report to change the parameter several times.
Example: by default we can have an ID set to 1, but I need the final user to change the ID via interaction with the report, say first change happens because he/she selects ID=2 via parameter, and after that he/she selects ID = 4.
Do you think it's possible?
Thanks again.
Fabio