Forum Discussion
dynamic web url - always todays date
Can anyone suggest how I am able to set the enddate to my url query to always be the latest date rather than a set number? I'm new to Powerbi and newer to queries!
Currently it looks like this Source = Json.Document(Web.Contents("https://api.websitename.com/api/reportextracts/?reportID=2908&startDate=2021-11-01&endDate=2022-02-02")),
I have also tried the following but get an error, but i'm not sure why. The API dates have to be formatted YYYY-MM-DD
endDateText = Date.ToText(DateTime.Date(DateTime.LocalNow()), "yyyy-mm-dd"),
Source = Json.Document(Web.Contents("https://api.websitename.com/api/reportextracts/?reportID=2908&startDate=2021-11-01&endDate=",endDateText)),
Error
Expression.Error: We cannot convert the value "2022-02-02" to type Record.
Details:
Value=2022-02-02
Type=[Type]
- Anonymous4 years ago
Try:
Source = Json.Document(Web.Contents("https://api.websitename.com/api/reportextracts/?reportID=2908&startDate=2021-11-01&endDate="&endDateText))
--Nate
2 Replies
- AnonymousNot applicable
Try:
Source = Json.Document(Web.Contents("https://api.websitename.com/api/reportextracts/?reportID=2908&startDate=2021-11-01&endDate="&endDateText))
--Nate
- webbjHelper I
This worked - thankyou