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

July 7 - July 17 | Round 2 of the Power BI Dataviz World Championships. Don't miss your chance! Learn more

Reply
Anonymous
Not applicable

variable in API URL JSON

Hello people,

I am using a JSON API string to fetch date from a date range which is parameterized. Because of that I have to change values everyday to fetch details. This URL look something like this :

 

Source = Json.Document(Web.Contents(XXXXXX&from_date=2018-07-01+00%3A00%3A00&to_date=2018-07-18+12%3A00%3A00&XXXXX"))

 

Now I need to set to_date as TODAY() in yyyy-mm-dd hh:mm:ss format. Help me with this.

 

Thanks and Regards,

Piyush

3 REPLIES 3
v-jiascu-msft
Microsoft Employee
Microsoft Employee

Hi Piyush,

 

Please try the function datetime-localnow. It could be like below.

let
    now = DateTime.LocalNow(),
    Source = Json.Document(Web.Contents(XXXXXX&from_date=2018-07-01+00%3A00%3A00&to_date=now))
in
    Source

Best Regards,

Dale

Community Support Team _ Dale
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Anonymous
Not applicable

Hi Dale,

Thanks for your help. I tried your way but it's not resolving my purpose instead it's showing following error :

 

Capture.PNG

 

I also tried this -> now = Date.AddDays(Date.From(DateTime.LocalNow()),-1),

Kindly suggest

 

Thanks,

Piyush

Hi Piyush,

 

It seems the error was raised by other errors. Can you share the file or the Power Query code?

 

Best Regards,

Dale

Community Support Team _ Dale
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

Helpful resources

Announcements
FabCon and SQLCon Barcelona 2026

FabCon & SQLCon – Barcelona 2026

Join us in Barcelona for FabCon and SQLCon, the Fabric, Power BI, SQL, and AI community event. Save €200 with code FABCMTY200.

60 days of Data Days Carousel

Data Days 2026

Join Fabric Data Days 2026: 60 days of free live/on-demand sessions, challenges, study groups, and certification opportunities.

Power BI DataViz World Championships carousel

Power BI DataViz World Championships - June 2026

A new Power BI DataViz World Championship is coming this June! Don't miss out on submitting your entry.

Top Solution Authors