Forum Discussion
Burn-up graph based on multiple variables
- Anonymous7 years ago
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
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
Anonymous
Works like a charm, thanks - This is a great help! Now I have only a small problem.
In my dataset, a case can change status multiple times during a single day and can therefore have multiple statusses in the span of a day. Assuming I have a time variable as well, how do i ensure that only the 'newest' case status is displayed in my graph?
Best regards and thank you in advance.