Как получить начальную и конечную дату подпроектов (Scope.Name) в VersionOne с использованием API в Power BI? - PullRequest
1 голос
/ 29 января 2020

Я работаю над отчетом Power BI, в котором в качестве источника используется API VersionOne. В настоящее время отчет показывает дату начала и окончания проекта, но мне нужно получить дату начала и окончания на уровне подпроекта. Подпроект называется Scope.Name в метаданных.

M-Query, показанный ниже, используется для получения основной массы данных.

Примечание: Я довольно новичок в работе с API в Power BI.


Пожалуйста, дайте мне знать, какой синтаксис используется для получения дата начала / начала и дата окончания на уровне подпроекта.

let
    Source = Xml.Tables(Web.Contents("https://www4.v1host.com/VGT/rest-1.v1/Data/PrimaryWorkitem?sel=Number,AssetType,AssetState,Scope.Name,Name,Status.Name,Estimate,ClosedDate,CreateDate&where=Scope.ParentMeAndUp.Name=%27VGT-Software%20Engineering%27", [Headers=[Authorization="Bearer "&access_token,ContentType="application/xml"]])),
    #"Changed Type" = Table.TransformColumnTypes(Source,{{"Attribute:total", Int64.Type}, {"Attribute:pageSize", Int64.Type}, {"Attribute:pageStart", Int64.Type}}),
    #"Removed Columns" = Table.RemoveColumns(#"Changed Type",{"Attribute:total", "Attribute:pageSize", "Attribute:pageStart"}),
    #"Expanded Asset" = Table.ExpandTableColumn(#"Removed Columns", "Asset", {"Relation", "Attribute", "Attribute:href", "Attribute:id"}, {"Asset.Relation", "Asset.Attribute", "Asset.Attribute:href", "Asset.Attribute:id"}),
    #"Expanded Asset.Relation" = Table.ExpandTableColumn(#"Expanded Asset", "Asset.Relation", {"Asset", "Attribute:name"}, {"Asset.Relation.Asset", "Asset.Relation.Attribute:name"}),
    #"Expanded Asset.Relation.Asset" = Table.ExpandTableColumn(#"Expanded Asset.Relation", "Asset.Relation.Asset", {"Attribute:href", "Attribute:idref"}, {"Asset.Relation.Asset.Attribute:href", "Asset.Relation.Asset.Attribute:idref"}),
    #"Expanded Asset.Attribute" = Table.ExpandTableColumn(#"Expanded Asset.Relation.Asset", "Asset.Attribute", {"Element:Text", "Attribute:name", "Value"}, {"Asset.Attribute.Element:Text", "Asset.Attribute.Attribute:name", "Asset.Attribute.Value"}),
    #"Renamed Columns" = Table.RenameColumns(#"Expanded Asset.Attribute",{{"Asset.Attribute.Attribute:name", "asset.attribute.attribute:name"}, {"Asset.Attribute.Element:Text", "asset.attribute.element:text"}}),
    #"Pivoted Column1" = Table.Pivot(#"Renamed Columns", List.Distinct(#"Renamed Columns"[#"asset.attribute.attribute:name"]), "asset.attribute.attribute:name", "asset.attribute.element:text"),
    #"Merged Queries" = Table.NestedJoin(#"Pivoted Column1", {"Asset.Attribute:id"}, #"Releases Linked to SandD", {"Asset.Attribute:id"}, "Releases Linked to SandD", JoinKind.Inner),
    #"Removed Columns1" = Table.RemoveColumns(#"Merged Queries",{"Asset.Attribute.Value", "Asset.Relation.Asset.Attribute:href", "Asset.Relation.Asset.Attribute:idref", "Asset.Relation.Attribute:name"}),
    #"Reordered Columns" = Table.ReorderColumns(#"Removed Columns1",{"Releases Linked to SandD", "Asset.Attribute:href", "Asset.Attribute:id", "Number", "AssetType", "AssetState", "Scope.Name", "Name", "Status.Name", "Estimate", "ClosedDate", "CreateDate"}),
    #"Expanded Releases Linked to SandD" = Table.ExpandTableColumn(#"Reordered Columns", "Releases Linked to SandD", {"Asset.Attribute.Value.Element:Text", "Asset.Attribute:id", "Active Releases.Asset.Attribute:href", "Active Releases.Asset.Attribute:id", "Active Releases.Parent.Name", "Active Releases.Active Release", "Active Releases.AssetState", "Active Releases.BeginDate", "Active Releases.EndDate", "Active Releases.Active Releases with Estimatesv1.Asset.Attribute:id", "Active Releases.Active Releases with Estimatesv1.TopParent.Name", "Active Releases.Active Releases with Estimatesv1.Tier 2 Name", "Active Releases.Active Releases with Estimatesv1.Tier 2 AssetState"}, {"Releases Linked to SandD.Asset.Attribute.Value.Element:Text", "Releases Linked to SandD.Asset.Attribute:id", "Releases Linked to SandD.Active Releases.Asset.Attribute:href", "Releases Linked to SandD.Active Releases.Asset.Attribute:id", "Releases Linked to SandD.Active Releases.Parent.Name", "Releases Linked to SandD.Active Releases.Active Release", "Releases Linked to SandD.Active Releases.AssetState", "Releases Linked to SandD.Active Releases.BeginDate", "Releases Linked to SandD.Active Releases.EndDate", "Releases Linked to SandD.Active Releases.Active Releases with Estimatesv1.Asset.", "Releases Linked to SandD.Active Releases.Active Releases with Estimatesv1.TopPar", "Releases Linked to SandD.Active Releases.Active Releases with Estimatesv1.Tier 2", "Releases Linked to SandD.Active Releases.Active Releases with Estimatesv1.Tier.1"}),
    #"Inserted Text Before Delimiter" = Table.AddColumn(#"Expanded Releases Linked to SandD", "Text Before Delimiter", each Text.BeforeDelimiter([ClosedDate], "T"), type text),
    #"Inserted Text Before Delimiter1" = Table.AddColumn(#"Inserted Text Before Delimiter", "Text Before Delimiter.1", each Text.BeforeDelimiter([CreateDate], "T"), type text),
    #"Renamed Columns1" = Table.RenameColumns(#"Inserted Text Before Delimiter1",{{"Text Before Delimiter", "ActualCLosedDAte"}, {"Text Before Delimiter.1", "ActualCreatedate"}}),
    #"Changed Type1" = Table.TransformColumnTypes(#"Renamed Columns1",{{"ActualCLosedDAte", type date}})
in
    #"Changed Type1"
...