Forum Discussion

JeevanMallya's avatar
JeevanMallya
Resolver II
2 years ago
Solved

Unique Sprint Story Points Calculation

I am trying to Calculate Sprint Commitmment.There are some stories that are not completed in the same sprint and gets moved to next sprint.In such cases i dont want to add this story points twice. He...
  • dufoq3's avatar
    dufoq3
    2 years ago

    Done.

     

    Result

     

    let
        Source = Table.FromRows(Json.Document(Binary.Decompress(Binary.FromText("lZZNTgMxDIWvgmbNInbsOFlDF0iUIkBsqh6ADUKI+4v0dzqpPeN0MepIn57ePDuOt9uBCYmG++H95/fr++8OA9aX4/Nhs359Xn2sHuv/MOzut0PCEMo1HA/w/vn04sDpgJOuzYJJN6Jqt/iClRYfrbyt1pvPazQBRHciCUrWbShwhkTuPDJI7PjAFh+1pzjrOB9wbqyc4cTgKY2B65mMsGFkqh1PuJSiW9Hg+luG6QiXlBzKp7RLRnbbqLB44iMdtwpv4HpTHWEJUEBP+/YjJTSjYa6397AxGjSYKC97PsOcO+BUjHE2DQ91XHc9wkbRLW32awsEb/dVGA1YGw03+HxpJLuaFXXcalYD12s5wh23zQ1uTcCo4/pROMM5OSbJyQhAcE8SAczGtafB0Ro7aiItPlt4iOw/ZkDRf9qBSk8dW3zeCEf0GxFhv3LOxqnRXTf4vHahLu0GX9I2ErG00a1ddYwA2y1KEIKxj2i6CP7eQ+pIGrlHmckxnS4wGxulmnOLz968FXaNMgNf0BYjEUN7ilv72QUvnXiH8xRCj7akjsQzGouRrl2Sa2ut+O4f", BinaryEncoding.Base64), Compression.Deflate)), let _t = ((type nullable text) meta [Serialized.Text = true]) in type table [ISSUE_KEY = _t, SPRINT_NAME = _t, SPRINT_NUMBER = _t, SPRINT_REPORT_STATUS = _t, STORY_POINTS_COMMITTED = _t]),
        ChangedType = Table.TransformColumnTypes(Source,{{"STORY_POINTS_COMMITTED", Int64.Type}, {"ISSUE_KEY", Int64.Type}, {"SPRINT_NUMBER", Int64.Type}}),
        GroupedRows = Table.Group(ChangedType, {"ISSUE_KEY"}, {
            {"All", each _, type table [SSUE_KEY=nullable number, SPRINT_NAME=nullable text, SPRINT_NUMBER=nullable number, SPRINT_REPORT_STATUS=nullable text, STORY_POINTS_COMMITTED=nullable number]},
            {"Points", each List.Max([STORY_POINTS_COMMITTED]), Int64.Type} }),
        BufferedPoints = List.Buffer(GroupedRows[Points]),
        GenerateHelper = List.Generate(
            ()=> [ x = 0, y = BufferedPoints{x} ],
            each [x] < List.Count(BufferedPoints),
            each [ x = [x]+1, y = [y] + BufferedPoints{x} ],
            each [y]
    ),
        Merged = Table.FromColumns(Table.ToColumns(GroupedRows) & { {0} & List.RemoveLastN(GenerateHelper, 1)}, Value.Type(GroupedRows & #table(type table[Helper=Int64.Type],{}))),
        Ad_InnerColumn = Table.AddColumn(Merged, "All With Total Column", each Table.AddColumn([All], "Total Story Points Committed", (x)=> x[STORY_POINTS_COMMITTED] + [Helper], Int64.Type), type table),
        Combined = Table.Combine(Ad_InnerColumn[All With Total Column])
    in
        Combined