cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Jar343 Frequent Visitor
Frequent Visitor

Auto Update URL Data Source

Hi,

 

Im new with Power BI and have run in a issue.

 

The data that i use i get by using Web as datasource and then entering the URL.

 

The problem is that the URL contains a Begin and Endate. namely .CVS?from=2016-07-26&to=2016-07-27

 

My question is how do i replace these value automaticlaly with the the Current Date in to= And the day of Yesterday for from=

 

 

1 ACCEPTED SOLUTION

Accepted Solutions
Community Support Team
Community Support Team

Re: Auto Update URL Data Source

Hi Jar343,

 

Based on my research, you could try to use Power Query Formula Language (informally known as "M") in the Advanced Editor.

let
    Source = Web.Page(Web.Contents("http://www.domain.com/xxx.CVS?from=" & DateTime.ToText(Date.AddDays(DateTime.LocalNow(), -1), "yyyy-MM-dd") & "&to=" & DateTime.ToText(DateTime.LocalNow(), "yyyy-MM-dd"))),
    Data0 = Source{0}[Data]
in
    Data0
Community Support Team _ Sam Zha
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

View solution in original post

3 REPLIES 3
Community Support Team
Community Support Team

Re: Auto Update URL Data Source

Hi Jar343,

 

Based on my research, you could try to use Power Query Formula Language (informally known as "M") in the Advanced Editor.

let
    Source = Web.Page(Web.Contents("http://www.domain.com/xxx.CVS?from=" & DateTime.ToText(Date.AddDays(DateTime.LocalNow(), -1), "yyyy-MM-dd") & "&to=" & DateTime.ToText(DateTime.LocalNow(), "yyyy-MM-dd"))),
    Data0 = Source{0}[Data]
in
    Data0
Community Support Team _ Sam Zha
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

View solution in original post

Jar343 Frequent Visitor
Frequent Visitor

Re: Auto Update URL Data Source

Hi Sam,

 

Thanks for your help it works quite good but because of the Power Query Foluma i have run in another issue.

 

With your code the data that is shown is only from today the -1 does not seem to do anithing i have also changed it to -4 with no effect.

 

I have tried changin your code to

 

from=" & DateTime.ToText(Date.AddDays(Date.From(DateTime.LocalNow()), -1), "yyyy-MM-dd") & "&to=" & DateTime.ToText(DateTime.LocalNow(), "yyyy-MM-dd"))),

in #""

 

But now i get the error

Expression.Error: Can not convert the value #date(2016, 8, 😎 to type DateTime.
Details:
    Value=8/8/2016
    Type=Type

 

Finally I also tried to do the Load from with static values but to now effect

 

Jar343 Frequent Visitor
Frequent Visitor

Re: Auto Update URL Data Source

Hi Sam,

 

Yoour solution worked perfectly just had to remove the space in

 

(Date.From(DateTime.Lo​calNow()), -1), 

TO

 

(Date.From(DateTime.Lo​calNow()),-1), 

 

 

Helpful resources

Announcements
New Topics Started Badges Coming

New Topics Started Badges Coming

We're releasing new versions of the badge that everyone's talking about. ;) Check your inbox for notifications.

MBAS 2020

Save the new date (and location)!

Our business applications community is growing—so we needed a different venue, resulting in a new date and location. See you there!

Difinity Conference

Difinity Conference

The largest Power BI, Power Platform, and Data conference in New Zealand

Power Platform 2019 release wave 2 plan

Power Platform 2019 release wave 2 plan

Features releasing from October 2019 through March 2020

Top Solution Authors
Top Kudoed Authors (Last 30 Days)