Forum Discussion
Power BI Query Parameters in the UI Report
Often, we have to link to website data via API, and we use query parameters for parts of its API.
for example, the parameter 'location' is being used in part of its API as below:
How are we able to bring this parameter 'location' to the UI report itself, such that user has a list of locations to choose from?
Hi Anonymous,
Use & to combine these strings and
First, you need create a parameter named location or something you like and use this M code to do it:
let yourkey = "PVACBQ6LTCVBR9NBF529V3H8V", url = "https://weather.visualcrossing.com/VisualCrossingWebServices/rest/services/timeline/"& location &"?key="& yourkey, data = Json.Document( Web.Contents(url)) in dataReault:
Best Regards
Community Support Team _ chenwu zhu
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
5 Replies
- SpartaBICommunity Champion
Anonymous
It's a long answer 🙂
Check this official doc:
https://docs.microsoft.com/en-us/power-bi/connect-data/desktop-dynamic-m-query-parameters- AnonymousNot applicable
Thanks for the link and prompt reply, I will give it a try and let you know 🙂
I am not sure if that works for API, hopefully it works.
- SpartaBICommunity Champion
Anonymous I'm not sure also 😃
- v-chenwuz-msftCommunity Support
Hi Anonymous,
Use & to combine these strings and
First, you need create a parameter named location or something you like and use this M code to do it:
let yourkey = "PVACBQ6LTCVBR9NBF529V3H8V", url = "https://weather.visualcrossing.com/VisualCrossingWebServices/rest/services/timeline/"& location &"?key="& yourkey, data = Json.Document( Web.Contents(url)) in dataReault:
Best Regards
Community Support Team _ chenwu zhu
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
- AnonymousNot applicable
with the code in M code, I have below error: