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

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now! Learn more

Reply
Madhu155154
Helper I
Helper I

How to change static date to dynamic date in API, for refreshing data - to current date

Any suggestion on how to change the "end date" from static to "dynamic to the (current) Present date" for capturing the data till the current date, while refreshing it,

Data - I got the data through the API


Current Issue - I am changing the end date manually in the Power Query 


Hpqv8CV.png

 

 

 

1 ACCEPTED SOLUTION
Madhu155154
Helper I
Helper I

I have used the below formula to get the date and  then passed it as a parameter in API, But Thank you for your support and suggestion 

currentDate = Date.ToText(DateTime.Date(DateTime.LocalNow()), "yyyy-MM-dd"),


let

currentDate = Date.ToText(DateTime.Date(DateTime.LocalNow()), "yyyy-MM-dd"),


Source = Json.Document(Web.Contents("https://cs-intmgroservices.io/intmgmtsvc/report/nReport" & "?startDt=2020-01-01&endDt=currentDate",



View solution in original post

6 REPLIES 6
Madhu155154
Helper I
Helper I

I have used the below formula to get the date and  then passed it as a parameter in API, But Thank you for your support and suggestion 

currentDate = Date.ToText(DateTime.Date(DateTime.LocalNow()), "yyyy-MM-dd"),


let

currentDate = Date.ToText(DateTime.Date(DateTime.LocalNow()), "yyyy-MM-dd"),


Source = Json.Document(Web.Contents("https://cs-intmgroservices.io/intmgmtsvc/report/nReport" & "?startDt=2020-01-01&endDt=currentDate",



Madhu155154
Helper I
Helper I

 @Mahesh0016  , Thank you for replying.

I1.png I, have used  your suggested function in the power query, but  i am getting an error

@Please Try this. Thank You.
endDt
= #date(
Date.Year(DateTime.Date(DateTime.LocalNow())),
Date.Month(DateTime.Date(DateTime.LocalNow())),
Date.Day(DateTime.Date(DateTime.LocalNow()))
)

 2.png I have used  your suggested function in the power query, but  still I am getting an error

@Madhu155154  please try this one.
endDt=

Date.ToText(#date(Date.Year(DateTime.Date(DateTime.LocalNow())), Date.Month(DateTime.Date(DateTime.LocalNow())), Date.Day(DateTime.Date(DateTime.LocalNow()))), [Format="YYYY-MM-DD", Culture="en-US"])

Mahesh0016
Super User
Super User

@Madhu155154 I hope this helps you. Thank You.

endDt = DateTime.Date( DateTime.LocalNow() )

 

Helpful resources

Announcements
Power BI DataViz World Championships

Power BI Dataviz World Championships

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now!

December 2025 Power BI Update Carousel

Power BI Monthly Update - December 2025

Check out the December 2025 Power BI Holiday Recap!

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.