Forum Discussion

BerlinAlexander's avatar
6 years ago

Automatically updated date in the connection to data source (web)

Hi everyone. I want to use an api connection to get some data. I tried to use the simple "Get Data" -> "Web" method and it worked fine. I then tried to use the Power Query advanced editor and it also works. The code is:

= Json.Document(Web.Contents("[WebpageAdress]/api/sale/by-period?date-from=2020-01-01&date-to=2020-01-29"))

The problem is I would like the link to update automatically when I refresh the report. As you see, there's info on the start date and end date in the line quoted above. I would like these dates to update authomatically. Otherwise I would get data for the same period repeatedly, which is pointless. I would like to always have:

Today minus 29 days as the start date ("date-from")
Today minus 1 day as the end date ("date-to")

I've been trying for find a solution for hours with no luck. Any ideas?

2 Replies