Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

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.

Reply
webbj
Helper I
Helper I

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-0...")),

 

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]

1 ACCEPTED SOLUTION
Anonymous
Not applicable

2 REPLIES 2
Anonymous
Not applicable

Try:

 

Source = Json.Document(Web.Contents("https://api.websitename.com/api/reportextracts/?reportID=2908&startDate=2021-11-01&endDate="&endDateText))

 

--Nate

This worked - thankyou 

Helpful resources

Announcements
FabCon Global Hackathon Carousel

FabCon Global Hackathon

Join the Fabric FabCon Global Hackathon—running virtually through Nov 3. Open to all skill levels. $10,000 in prizes!

October Power BI Update Carousel

Power BI Monthly Update - October 2025

Check out the October 2025 Power BI update to learn about new features.

FabCon Atlanta 2026 carousel

FabCon Atlanta 2026

Join us at FabCon Atlanta, March 16-20, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.

Top Kudoed Authors