Forum Discussion
Creating a Report froma source with an API connect
- 1 year ago
Thankyou, DataNinja777, for your response.
Hi Walt101062,We appreciate your question posted on the Microsoft Fabric Community Forum.
As per my understanding, since the API requires From and To dates, Power BI lets users enter the dates, which we can then use in the API request by creating Parameters in Power BI Desktop.
Please follow the steps below to resolve the issue:
- In Power BI Desktop, go to Manage Parameters and create two parameters named StartDate (type: Date) and EndDate (type: Date).
- Modify the API URL in Power Query and include these parameters in the API URL as shown in the example.
let
StartDateText = Date.ToText(StartDate, "yyyy-MM-dd"),
EndDateText = Date.ToText(EndDate, "yyyy-MM-dd"),
Source = Json.Document(Web.Contents("https://your-api-endpoint.com/data?",
[Query = [from = StartDateText, to = EndDateText]]
))
in
Source
- Change the parameter values before refresh. In Power BI Desktop, you can update these values directly. In Power BI Service, go to Dataset, then Settings, and then Parameters to update and refresh.
Additionally, please refer to the following links for more information:
Parameters - Power Query | Microsoft Learn
Web.Contents - PowerQuery M | Microsoft LearnIf you find our response useful, kindly mark it as the accepted solution and give kudos. This will help other community members who have similar questions.
If you have any further queries, please feel free to contact the Microsoft Fabric community.
Thank you.
Hi Walt101062,
We wanted to follow up since we haven’t heard back from you regarding your query. If you’ve figured out a solution, please share it with the community—it might really help others dealing with the same issue.
If you found any response useful, kindly mark it as the accepted solution and give kudos. This helps others find answers more easily.
Thank you.