Rules / Error Prevention

Data source the service can't refresh

error DYNAMIC_DATA_SOURCE · built in · Power Query layer · scope: Partition, NamedExpression, Table

What it checks

Data sources whose address the Power BI service cannot know before the query runs: a call such as Web.Contents, File.Contents, or Sql.Database whose first argument is read from a table's rows, built by a function call, chosen with if ... then ... else, or a custom function's parameter.

Each finding names the partition, the shared expression, or, for an incremental refresh policy's own query, the table. Its detail names the query and the step, then the function and where its address comes from, as query 'Orders', step 'Added Custom': Web.Contents's address is read from the rows. The other endings, in the order the detail prefers them when more than one applies, are is built by a function call, is a custom function's parameter, and is chosen with if ... then ... else. The location is the line and column of the call in the TMDL file.

Example

Fires the rule
table Orders
	column Body
		dataType: binary
		summarizeBy: none
		sourceColumn: Body

	partition Orders = m
		mode: import
		source =
				let
					Source = #table(type table [url = text], {{"https://api.example.com/v1/orders/1"}, {"https://api.example.com/v1/orders/2"}}),
					#"Added Custom" = Table.AddColumn(Source, "Body", each Web.Contents([url]))
				in
					#"Added Custom"
After the fix
table Orders
	column Body
		dataType: binary
		summarizeBy: none
		sourceColumn: Body

	partition Orders = m
		mode: import
		source =
				let
					Source = #table(type table [id = number], {{1}, {2}}),
					#"Added Custom" = Table.AddColumn(Source, "Body", each Web.Contents("https://api.example.com", [RelativePath = "v1/orders/" & Text.From([id])]))
				in
					#"Added Custom"

Why it matters

Microsoft defines the term: "A dynamic data source is a data source in which some or all of the information required to connect can't be determined until Power Query runs its query, because the data is generated in code or returned from another data source." And it says what follows: "In most cases, Power BI semantic models that use dynamic data sources can't 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." (Refresh and dynamic data sources (opens in a new tab)). The query works in Power BI Desktop, so the problem shows only after publishing, when the model's refresh in the service fails and its reports go on showing old data.

How to fix it

In Power BI Desktop, choose Transform data, then Data source settings, and select Data sources in current file. Microsoft's own check is to "look for the warning message" there (Refresh and dynamic data sources (opens in a new tab)). Then select the query, and the step the finding names in Applied steps.

In the TMDL file, the call is in the partition's source block.

When to ignore it

A model that is never published, or never refreshed in the service, can build its addresses however it likes. If Data source settings shows no warning for the source, the service can work it out after all, and you can ignore the finding.

To ignore this rule on one object, add annotation pbiplint.ignore = DYNAMIC_DATA_SOURCE under the object in its TMDL file. Power BI Desktop keeps the annotation. To turn the rule off for a whole project, set "DYNAMIC_DATA_SOURCE": "off" under rules in pbiplint.config.json.

Quirks

Check a model for this Improve this page (opens in a new tab)