TiffanySK
TiffanySK

Reputation: 11

How do I get the start and end date of SubProjects (Scope.Name) in VersionOne using an API in Power BI?

I am working on a Power BI report which uses a VersionOne API as the source. The report currently shows the start and end date of the project, but I need to get the start and end date at the sub-project level. The sub-project is called the Scope.Name in the metadata.

M-Query shown below is used to get the bulk of the data.

Note: I'm fairly new working with the APIs in Power BI.


Please let me know what is the appropriate syntax to use to get the start/begin date and end-date at the sub-project level.

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"

Upvotes: 1

Views: 175

Answers (0)

Related Questions