Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.

Reply
AKSteffensen
Frequent Visitor

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 keyStart DateCase TypeCase Status
A-111-05-2019AOpen
A-211-05-2019AIn progress
B-111-05-2019BOpen
B-211-05-2019BClosed
C-112-05-2019COpen
C-212-05-2019CIn progress
A-112-05-2019AIn progress
B-313-05-2019BClosed
A-113-05-2019AClosed

 

Note that a case can have any status from the start. Based on the dates and the 'case status' variable I need to create a burn-up chart in PBI displaying the dates on the x-axis and the number of cases having the different statusses on the y-axis. Something like this. Notice that once the case status changes it moves to another status in the graph, and its previous status should no longer be represented by subsequent dates.

 

To be able to do so, I believe I have to first calculate the total case type for each day as a measure

 

TotalCaseType = COUNT('Table'[Case Status])

 

and then use a PBI table to divide the counts into case type, date and case status. This should be doable in a stacked area chart as well? This works decently and I obtain a table like this:

 

Status Start DateIssue TypeStatusCountCount Running Total
11-05-2019AOpen11
11-05-2019AIn progress11
11-05-2019BOpen11
11-05-2019BClosed11
12-05-2019COpen11
12-05-2019CIn progress11
12-05-2019BOpen11
12-05-2019AIn progress12
13-05-2019AClosed11
13-05-2019BClosed12

 

Now I would like to create a running total over the dates that divides the cumulation based on both Case Type and Case Status (the variable displayed to the far right). Futhermore, as mentioned avobe, once the case status changes, its previous status should no longer be represented on subsequent dates (in the running total). Note for instance how A-1 is counted in the running total of 'In progress' once it changes stauts the first time, and only in the running total of 'closed' when it changes status the second time. To create such a measure, I have tried various things, such as

 

CALCULATE(
                    COUNT('Table'[Case Status]);
                    FILTER(
                        ALL('DateTable');
                        'DateTable'[FullDateAlternateKey] <= MAX('DateTable'[FullDateAlternateKey])))

but everything seems to just return the count for the specific categories on a given date, and not a running total. What am I doing wrong?

 

 

 

1 ACCEPTED SOLUTION
Anonymous
Not applicable

@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

View solution in original post

2 REPLIES 2
Anonymous
Not applicable

@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

@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.

 

 

Helpful resources

Announcements
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

Check out the April 2024 Power BI update to learn about new features.

April Fabric Community Update

Fabric Community Update - April 2024

Find out what's new and trending in the Fabric Community.