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

Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.

Reply
zbeg
Frequent Visitor

Scheduled refresh error "This dataset includes a dynamic data source" with different base URLs

So I have an unusual use case. I have created a dataset that goes out to each of the 32 NFL teams and downloads:

 

Their roster (5 tables)

Their injury report (1 table)

Their depth chart (1 table)

 

https://www.azcardinals.com/team/player-roster

https://www.atlantafalcons.com/team/player-roster

https://www.chicagobears.com/team/player-roster

(29 more similar URLs)

https://www.azcardinals.com/team/injury-report

https://www.atlantafalcons.com/team/injury-report

 

(30 more)

https://www.azcardinals.com/team/depth-chart

https://www.atlantafalcons.com/team/depth-chart

(30 more)

 

This way I can look at each team's website, who is on the active roster, who is listed under COVID-reserve, injured reserve, etc., if someone missed practice I can relate that to the depth chart and see if the starter is injured. It's very neat. This is a simplified query with just three teams (but yields the same problem) so you can follow along if you'd like:

 

let 
TeamList = {
"azcardinals", "atlantafalcons", "chicagobears"
},

Get_DepthChart = (teamName as text) =>

/* extracts table from: www.foo.com/team/depth-chart */
let
Source = Web.BrowserContents("https://www." & teamName & ".com/team/depth-chart"),
#"Extracted Table From Html" = Html.Table(Source, {{"Column1", "DIV[id='scroll-offense'] > DIV.d3-o-table--horizontal-scroll > TABLE.d3-o-table.d3-o-table--row-striping.d3-o-table--detailed.d3-o-depthchart > * > TR > :nth-child(1)"}, {"Column2", "DIV[id='scroll-offense'] > DIV.d3-o-table--horizontal-scroll > TABLE.d3-o-table.d3-o-table--row-striping.d3-o-table--detailed.d3-o-depthchart > * > TR > :nth-child(2)"}, {"Column3", "DIV[id='scroll-offense'] > DIV.d3-o-table--horizontal-scroll > TABLE.d3-o-table.d3-o-table--row-striping.d3-o-table--detailed.d3-o-depthchart > * > TR > :nth-child(3)"}, {"Column4", "DIV[id='scroll-offense'] > DIV.d3-o-table--horizontal-scroll > TABLE.d3-o-table.d3-o-table--row-striping.d3-o-table--detailed.d3-o-depthchart > * > TR > :nth-child(4)"}, {"Column5", "DIV[id='scroll-offense'] > DIV.d3-o-table--horizontal-scroll > TABLE.d3-o-table.d3-o-table--row-striping.d3-o-table--detailed.d3-o-depthchart > * > TR > :nth-child(5)"}}, [RowSelector="DIV[id='scroll-offense'] > DIV.d3-o-table--horizontal-scroll > TABLE.d3-o-table.d3-o-table--row-striping.d3-o-table--detailed.d3-o-depthchart > * > TR"]),
#"Changed Type" = Table.TransformColumnTypes(#"Extracted Table From Html",{{"Column1", type text}, {"Column2", type text}, {"Column3", type text}, {"Column4", type text}, {"Column5", type text}})
in
#"Changed Type",
List_DepthChartTables = List.Transform(
TeamList,
each Get_DepthChart(_)
),
#"Converted to Table" = Table.FromList(List_DepthChartTables, Splitter.SplitByNothing(), null, null, ExtraValues.Error),
#"Expanded Column1" = Table.ExpandTableColumn(#"Converted to Table", "Column1", {"Column1", "Column2", "Column3", "Column4", "Column5"}, {"Column1.Column1", "Column1.Column2", "Column1.Column3", "Column1.Column4", "Column1.Column5"})
in
#"Expanded Column1"

 

However, when I try to set up a scheduled refresh in the Power BI Service, I get the following error:

 

"This dataset includes a dynamic data source. Since dynamic data sources aren't refreshed in the Power BI service, this dataset won't be refreshed. Learn more: https://aka.ms/dynamic-data-sources."

 

Okay, so let's wander over to the URL and see what it says (emphasis mine):

 

"A dynamic data source is a data source in which some or all of the information required to connect cannot be determined until Power Query runs its query, because the data is generated in code or returned from another data source. Examples include: the instance name and database of a SQL Server database; the path of a CSV file; or the URL of a web service.

 

In most cases, Power BI datasets that use dynamic data sources cannot be refreshed in the Power BI service. There are a few exceptions in which dynamic data sources can be refreshed in the Power BI service, such as when using the RelativePath and Query options with the Web.Contents M function. Queries that reference Power Query parameters can also be refreshed."

 

Indeed, doing some Googling Binging shows that the RelativePath and Query options are a workaround to this error.

 

https://medium.com/datadriveninvestor/setting-a-scheduled-refresh-on-a-dynamic-data-source-in-power-...

https://blog.crossjoin.co.uk/2016/08/16/using-the-relativepath-and-query-options-with-web-contents-i...

https://blog.crossjoin.co.uk/2016/08/23/web-contents-m-functions-and-dataset-refresh-errors-in-power...

 

As Chris Webb writes (emphasis once again mine):

"The problem is that when a published dataset is refreshed, Power BI does some static analysis on the code to determine what the data sources for the dataset are and whether the supplied credentials are correct. Unfortunately in some cases, such as when the definition of a data source depends on the parameters from a custom M function, that static analysis fails and therefore the dataset does not refresh."

 

However, each of these solutions are with the same base url. www.domain.com/q=24601, www.domain.com/q=31415 etc.

Here it's www.domain1.com/blah www.domain2.com/blah, which doesn't work with RelativePath in Web.Contents().

 

Excerpted from the WebContents() documentation:

 

"The record can contain the following fields:

  • RelativePath: Specifying this value as text appends it to the base URL before making the request."

 

So my RelativePath savior doesn't work because it only appends to the end of the base URL. Phooey.

 

Loading each table individually is not practical, as there are 224 of them!

 

I'm completely stuck and don't know where to go from here. Is this a Power Automate situation? (I've never used Power Automate before, but I can go with the flow if that's my only good option, but I would really like to stay in Power BI if I can.)

2 REPLIES 2
zbeg
Frequent Visitor

Update: I tried setting up a Power Automate Flow for this, but it doesn't seem to work. Everything says it's successful, but then nothing updates.

 

What are my options for setting up a scheduled refresh? I could try to learn the REST API to set up a scheduled refresh, although this gives me pause:

 

https://azure.microsoft.com/en-us/updates/power-bi-embedded-analytics-rest-api-schedule-refresh/

 

"Note that this API is relevant for cached (import mode) or composite models only."

 

I don't know what that means, but I'm getting increasingly frustrated with each new approach to this problem and failing. I just want to do a scheduled refresh with a variable in the base URL. You'd think this would be easier, buuuut

 

Any help would be much appreciated. Thank you!

 

 

Hi, @zbeg 

Sorry for that can't fix it on my side currently.

If you are a pro user ,please kindly raise it to the MS Support Team for better advice, thanks a lot!
https://powerbi.microsoft.com/en-us/support/ 

Support Ticket.gif

 

Best Regards,
Community Support Team _ Eason

Helpful resources

Announcements
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

Check out the April 2024 Power BI update to learn about new features.

April Fabric Community Update

Fabric Community Update - April 2024

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

Top Solution Authors
Top Kudoed Authors