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

Join us for an expert-led overview of the tools and concepts you'll need to become a Certified Power BI Data Analyst and pass exam PL-300. Register now.

Reply
glynwilks
Helper I
Helper I

Dynamic Date in Web Query

I am trying to do a POST request using the blank query editior. I need to include a body query within the source to specify the date in yyyy-mm-dd format. If I manually type the date i.e. 2022-05-22 then my query pulls data from the site. However, I am trying to make the query reference today's date, so that at any point in time I am referencing the latest data. Unfortunately the date is required in the body for this provider.

 

I am struggling to pull today's date, in the format, and pass it through to my URL. Below is the working query, where I specifiy the date manually. How do I make that date always be todays date?

 

let

body = "{""Dates"":""2022-05-22""}",
Source = Json.Document(Web.Contents("https://app.officevibe.com/api/v2/engagement", [Headers=[Authorization="Bearer fakeapikey123423424242424", #"Content-Type"="application/json"], Content = Text.ToBinary(body)]))
in
Source

1 ACCEPTED SOLUTION
Vijay_A_Verma
Super User
Super User

For body use this

body = "{""Dates"":"&""""&Date.ToText(Date.From(DateTime.FixedLocalNow()),"yyyy-MM-dd")&""""&"}",

View solution in original post

2 REPLIES 2
Vijay_A_Verma
Super User
Super User

For body use this

body = "{""Dates"":"&""""&Date.ToText(Date.From(DateTime.FixedLocalNow()),"yyyy-MM-dd")&""""&"}",

Thank you very much Vijay. That worked a treat.

Helpful resources

Announcements
Join our Fabric User Panel

Join our Fabric User Panel

This is your chance to engage directly with the engineering team behind Fabric and Power BI. Share your experiences and shape the future.

June 2025 Power BI Update Carousel

Power BI Monthly Update - June 2025

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

June 2025 community update carousel

Fabric Community Update - June 2025

Find out what's new and trending in the Fabric community.