问题描述
我知道此问题以前已经发布过很多次,但是我无法获得可靠/有效的解决方案。
I know this issue has been posted many times before, but I was not able to get a solid/working solution.
我正在尝试找出一种通过Power BI服务使用自定义功能刷新数据集的解决方法。我的查询如下所示:
I am trying to figure out a workaround for refreshing dataset with Custom functions over Power BI service. My query looks like the following:
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"})
in
#"Expanded Details1"
在Power BI桌面上可以正常使用。但是,我在Power BI服务上遇到以下错误:
This works fine on Power BI desktop. However, I am getting following error on Power BI service:
推荐答案
我设法使其正常运行。通过一些研究,我们发现实际问题不是功能而是动态API路径本身。 Power BI在刷新服务上的报告之前会验证静态数据源路径。
I managed to make it work. With some research, we figured out that the actual problem was not the function but the dynamic API path itself. Power BI verifies the static data source path before refreshing the report on Service.
我通过替换以下方法解决了这个问题:
I solved the problem by replacing :
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"]]))
这篇关于如何刷新在Power BI Service上使用自定义功能的报告?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!