如何刷新在Power BI Service上使用自定义功能的报告?

时间:2018-12-01 06:56:51

标签: powerbi powerquery powerbi-desktop powerbi-datasource

我知道此问题以前已经发布过很多次,但是我无法获得可靠/有效的解决方案。

我试图找出一种解决方法,用于通过Power BI服务使用“自定义”功能刷新数据集。我的查询如下所示:

let
Clients = Json.Document(Web.Contents("https://api.createsend.com/api/v3.2/clients.json")),
#"Converted to Table" = Table.FromList(Clients, Splitter.SplitByNothing(), null, null, ExtraValues.Error),
#"Expanded Column1" = Table.ExpandRecordColumn(#"Converted to Table", "Column1", {"ClientID", "Name"}, {"ClientID", "Name"}),

GetDetails = (ClientID as text) => 
let 
    Source = Json.Document(Web.Contents("https://api.createsend.com/api/v3.2/clients/" & ClientID & "/campaigns.json"))
in 
    Source,
Output = Table.AddColumn(#"Expanded Column1", "Details", each GetDetails([ClientID])),
#"Expanded Details" = Table.ExpandListColumn(Output, "Details"),
#"Expanded Details1" = Table.ExpandRecordColumn(#"Expanded Details", "Details", {"Name", "FromName", "FromEmail", "ReplyTo", "SentDate", "TotalRecipients", "CampaignID", "Subject", "WebVersionURL", "WebVersionTextURL"}, {"Details.Name", "Details.FromName", "Details.FromEmail", "Details.ReplyTo", "Details.SentDate", "Details.TotalRecipients", "Details.CampaignID", "Details.Subject", "Details.WebVersionURL", "Details.WebVersionTextURL"})

在     #“ Expanded Details1”

这在Power BI桌面上正常工作。但是,我在Power BI服务上遇到以下错误: Query contains unknown or unsupported data sources. Web, https://api.createsend.com/api/v3.2/clients.json

1 个答案:

答案 0 :(得分:0)

我设法使其起作用。通过一些研究,我们发现实际问题不是功能而是动态API路径本身。 Power BI在刷新服务上的报告之前会验证静态数据源路径。

我通过替换解决了这个问题:

Source = Json.Document(Web.Contents("https://api.createsend.com/api/v3.2/clients/" & ClientID & "/campaigns.json"))

与此:

Json.Document(Web.Contents("https://api.createsend.com/", [RelativePath="api/v3.2/clients/" & ClientID & "/campaigns.json", Headers=[#"Authorization"="My API Authorization token"]]))