Forum Discussion

AKSteffensen's avatar
AKSteffensen
Frequent Visitor
7 years ago
Solved

Burn-up graph based on multiple variables

Hi,   I am experiencing some issues with a burn-up graph I am experimenting with. I am having data on the following form:   Case key Start Date Case Type Case Status A-1 11-05-2019 A ...
  • Anonymous's avatar
    Anonymous
    7 years ago

    AKSteffensen -

    You can create a new table in Power Query, with the below script.

    You can start with the source, and then add copy the other steps in the Advanced Editor.

    This also assumes that you have a calendar table called "Date" (bold and large).

    let
        Source = Table.FromRows(Json.Document(Binary.Decompress(Binary.FromText("i45WctQ1VNJRMtU3NNQ3MjC0BLIdgdi/IDVPKVYHJG2ERdozT6GgKD+9KLW4GKzKCcMQJ2RDnDAMAUk75+QXp6aAFTjD9BvBFDgj63eG6UeRRneEI4Yh2J1qDFFljMMtcGOMkY2BKYgFAA==", BinaryEncoding.Base64), Compression.Deflate)), let _t = ((type text) meta [Serialized.Text = true]) in type table [#"Case key" = _t, #"Start Date" = _t, #"Case Type" = _t, #"Case Status" = _t]),
        #"Changed Type" = Table.TransformColumnTypes(Source,{{"Start Date", type date}}),
        #"Grouped Rows" = Table.Group(#"Changed Type", {"Case key"}, {{"Min Date", each List.Min([Start Date]), type date}}),
        #"Added Custom" = Table.AddColumn(#"Grouped Rows", "Max Date", each List.Max(Table.Column(#"Grouped Rows", "Min Date"))),
        #"Added Custom1" = Table.AddColumn(#"Added Custom", "Custom", each Date),
        #"Expanded Custom" = Table.ExpandTableColumn(#"Added Custom1", "Custom", {"Date"}, {"Custom.Date"}),
        #"Added Custom2" = Table.AddColumn(#"Expanded Custom", "In Range", each if [Min Date] <= [Custom.Date] and [Max Date] >= [Custom.Date] then 1 else 0),
        #"Filtered Rows" = Table.SelectRows(#"Added Custom2", each ([In Range] = 1)),
        #"Removed Columns" = Table.RemoveColumns(#"Filtered Rows",{"Min Date", "Max Date", "In Range"}),
        #"Merged Queries" = Table.NestedJoin(#"Removed Columns", {"Case key", "Custom.Date"}, Status, {"Case key", "Start Date"}, "Status", JoinKind.LeftOuter),
        #"Expanded Status" = Table.ExpandTableColumn(#"Merged Queries", "Status", {"Case Type", "Case Status"}, {"Status.Case Type", "Status.Case Status"}),
        #"Sorted Rows" = Table.Sort(#"Expanded Status",{{"Case key", Order.Ascending}, {"Custom.Date", Order.Ascending}}),
        #"Filled Down" = Table.FillDown(#"Sorted Rows",{"Status.Case Type", "Status.Case Status"})
    in
        #"Filled Down"

    You can download the pbix here.

    Hope this helps,

    Nathan