我有 [WorkItems] tbl - 245 000 条记录,90 MB 原始大小 - 这是 PBI 报告的一部分。 它包含 30 个 API 参考(直接从 API 提取数据 - 30 个 OData Feed(项目))。 用 PowerQuery (OData) 编写的代码
当我刷新此 PBI 报告时,[WorkItems] 表不断失败,并显示以下消息:
我能够通过删除大约一半的 API 调用(OData 源)来降低 [WorkItems] tbl 大小 - 30 个中剩下 12 个。
然后tbl大小减少到42MB,现在大约10万条记录,刷新2分钟
(当我在 PBI 服务上发布它时需要 3 分钟;计划的刷新现在不会失败)。
但是 - 我的问题 - 我需要保留所有 30 个 OData Feed(项目)...
要实现这一点:
是否有有效且或多或少快捷的方法来减少此表大小?
我是否应该在数据源设置中添加某种参数 - 以加快刷新速度 - 更快地分段加载我的记录?
我添加了 [日期] 过滤器以减少表大小 - [当前日期] - 24 个月。但它并没有减少表的大小
这是 OData 中的代码,(我只包含 30 个 OData 源中的 3 个):
任何建议都会非常有帮助
// "$select=ParentWorkItemId, StoryPoints, State,
WorkItemType, Title, IterationSK, AreaSK, WorkItemId" & "&$filter=
(WorkItemType eq 'Bug' or WorkItemType eq 'User Story')", null,
[Implementation="2.0"]),
let
Source =
OData.Feed
("https://analytics.dev.azure.com/MyCompany/Research and
Development/_odata/v3.0-preview/WorkItems?" &
"$select=ParentWorkItemId, StoryPoints,
State,
WorkItemType, Title, IterationSK, AreaSK,
WorkItemId,
Area" & "&$filter=(WorkItemType eq 'Bug' or
WorkItemType eq 'User Story')" &
"&$expand=Area($select=AreaPath)", null,
[Implementation="2.0"]),
#"Add all Ops & CP projects" = Table.Combine({
Source,
OData.Feed("https://analytics.dev.azure.com/MyCompany/Cloud
Platform/_odata/v3.0-preview/WorkItems?" &
"$select=ParentWorkItemId, StoryPoints, State,
WorkItemType,
Title, IterationSK, AreaSK, WorkItemId, Area" &
"&$filter=
(WorkItemType eq 'Bug' or WorkItemType eq 'User
Story')" &
"&$expand=Area($select=AreaPath)", null,
[Implementation="2.0"]),
OData.Feed("https://analytics.dev.azure.com/MyCompany/Batch
Management/_odata/v3.0-preview/WorkItems?" &
"$select=ParentWorkItemId, StoryPoints, State,
WorkItemType,
Title, IterationSK, AreaSK, WorkItemId, Area" &
"&$filter=
(WorkItemType eq 'Bug' or WorkItemType eq 'User
Story')" &
"&$expand=Area($select=AreaPath)", null,
[Implementation="2.0"]),}),
#"Add AreaPath" = Table.ExpandRecordColumn(#"Add all Ops & CP
projects",
"Area", {"AreaPath"}, {"AreaPath"}),
// Calculate the date 24 months ago from the current date
Date24MonthsAgo = Date.AddMonths(DateTime.LocalNow(), -24),
// Filter data to include only records from the last 24 months
FilteredData = Table.SelectRows(ConvertedIDColumns, each
DateTime.From([CreatedDate]) >= Date24MonthsAgo),
#"Rename Story Points to Effort" = Table.RenameColumns(#"Add
AreaPath",
{{"StoryPoints", "Effort"}}),
#"Add Organization" = Table.AddColumn(#"Rename Story Points to
Effort",
"Organization", each "MyCompany"),
#"Change IDs to text" = Table.TransformColumnTypes(#"Add
Organization",
{{"WorkItemId", type text}, {"ParentWorkItemId", type text}}),
#"Make IDs unique" = Table.TransformColumns(
#"Change IDs to text",
{
{
"WorkItemId",
each
Text.Combine({(_),"-VSTS"}),
type text
}
}
),
#"Make Parent IDs unique" = Table.TransformColumns(
#"Make IDs unique",
{
{
"ParentWorkItemId",
each
Text.Combine({(_),"-VSTS"}),
type text
}
}
),
#"Replaced Value" = Table.ReplaceValue(#"Make Parent IDs
unique","-VSTS","",Replacer.ReplaceValue,{"ParentWorkItemId"}),
#"Parent Orphans to ""No Feature""" =
Table.ReplaceValue(#"Replaced Value","","No
Feature",Replacer.ReplaceValue,{"ParentWorkItemId"})
in
#"Parent Orphans to ""No Feature"""
您提出的 3 个问题都无法帮助解决问题的根本原因:
Are there working and more or less quick ways to reduce this tbl size?
Should I add some sort of parameter(s) into Data Source settings - in order to speed up the refresh - to load my records in parts, quicker?
I added [Date] filter to reduce a tbl size - [Current Date] - 24 months. But it didn't reduced tbl size
您受到 API 主机的限制。我的建议是使用 Function.InvokeAfter() 来错开您的 API 请求
https://learn.microsoft.com/en-us/powerquery-m/function-invokeafter