如何使用不同数据源 link 发布的同一份 PowerBI 报表?
How to use the same published PowerBI report with different data sources link?
我是 PowerBI 的新手,我需要使用通过不同 link 源创建的相同报告,这些源具有相同的 table 结构。
我使用其他 - Web 作为数据源并使用 link 像这样
http://db.other.com.br/nahar/infinity/rest/entitygrupo
其中infinity是数据库,我还有很多其他的:
http://db.other.com.br/nahar/rachu/rest/entitygrupo
检索到的数据完全一样
我想找到一种方法来以某种方式保持报告的完整性,而不需要创建报告只是为了更改源,因为我有很多数据库。如果我可以使用相同的已发布 link 并传递一些更改正在使用的 link 的参数,那将是完美的。
Parameters and templates 在 Power BI 中正是为这个用例提供服务。
假设我们有以下用于演示目的的数据源:
https://jsonplaceholder.typicode.com/posts/1
https://jsonplaceholder.typicode.com/posts/2
其中 1
和 2
等同于数据源中的数据库名称(infinity
和 rachu
)。
查询如下:
let
Source = Json.Document(Web.Contents("https://jsonplaceholder.typicode.com/posts/1")),
#"Converted to Table" = Record.ToTable(Source)
in
#"Converted to Table"
现在我们可以为 database_name
创建一个新参数:
然后我们可以去Advanced Editor
修改查询并参数化数据源:
let
Source = Json.Document(Web.Contents("https://jsonplaceholder.typicode.com/posts/" & database_name)),
#"Converted to Table" = Record.ToTable(Source)
in
#"Converted to Table"
您会注意到目前没有任何变化。
创建一个简单的 table 来显示数据 (id 1):
然后我们可以将报表导出为 Power BI 模板:
如果您打开模板文件,系统会要求您输入参数值。让我们为 database_name
尝试 2
然后点击加载:
您会看到该报表加载了来自数据库 2 (id 2) 的数据,并且它的报表布局与第一个相同:
我是 PowerBI 的新手,我需要使用通过不同 link 源创建的相同报告,这些源具有相同的 table 结构。
我使用其他 - Web 作为数据源并使用 link 像这样
http://db.other.com.br/nahar/infinity/rest/entitygrupo
其中infinity是数据库,我还有很多其他的:
http://db.other.com.br/nahar/rachu/rest/entitygrupo
检索到的数据完全一样
我想找到一种方法来以某种方式保持报告的完整性,而不需要创建报告只是为了更改源,因为我有很多数据库。如果我可以使用相同的已发布 link 并传递一些更改正在使用的 link 的参数,那将是完美的。
Parameters and templates 在 Power BI 中正是为这个用例提供服务。
假设我们有以下用于演示目的的数据源:
https://jsonplaceholder.typicode.com/posts/1
https://jsonplaceholder.typicode.com/posts/2
其中 1
和 2
等同于数据源中的数据库名称(infinity
和 rachu
)。
查询如下:
let
Source = Json.Document(Web.Contents("https://jsonplaceholder.typicode.com/posts/1")),
#"Converted to Table" = Record.ToTable(Source)
in
#"Converted to Table"
现在我们可以为 database_name
创建一个新参数:
然后我们可以去Advanced Editor
修改查询并参数化数据源:
let
Source = Json.Document(Web.Contents("https://jsonplaceholder.typicode.com/posts/" & database_name)),
#"Converted to Table" = Record.ToTable(Source)
in
#"Converted to Table"
您会注意到目前没有任何变化。
创建一个简单的 table 来显示数据 (id 1):
然后我们可以将报表导出为 Power BI 模板:
如果您打开模板文件,系统会要求您输入参数值。让我们为 database_name
尝试 2
然后点击加载:
您会看到该报表加载了来自数据库 2 (id 2) 的数据,并且它的报表布局与第一个相同: