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
Phoenix12
Frequent Visitor

Count open cases along with the amount associated with the open cases

Hello, 

I'm pretty new to Power BI and I'm trying to create a report with the total open cases for the month and total amount associated to the cases remaining open. Can someone help with me figure out how I can accomplish this? 

 

Table 

 IDCreated DateClosed DateStatusAmount 
110/1/202211/2/2022Closed$10
210/5/202210/25/2022Closed$5
310/8/2022 Open$10
410/20/202210/25/2022Closed$13
510/31/2022 Open$10
611/1/202211/30/2022Closed$25
711/12/2022 Open$15
811/15/202211/26/2022Closed$3
911/20/2022 Open$10
1011/28/2022 Open$5
1112/2/202212/10/2022Closed$6
1212/5/2022  $5
1312/9/2022 Open$10
1412/15/2022 Open$10
1512/20/202212/28/2022Closed$5

 

Expected Results: 

MonthOpen CountOpen Amount
Oct 20222$20
Nov 20223$30
Dec 20223$25
3 REPLIES 3
alannavarro
Resolver I
Resolver I

Hello, you can paste this in the advance editor
let
Source = Table.FromRows(Json.Document(Binary.Decompress(Binary.FromText("hZJBCsIwEEWvIsFlITOTTmzXPYAHCN3Znajg/cHo/NpIQ4QsPuTx8idJSo5d55g8eyGRd85pzdP1/lwuORyZDm7ukhOj9UuTF93janQwYliBvM6P5VYKe0joj5GD8WpI4IYz2hjlSIH2SkHLE3CpKcEMYLS8prh3ouUIghotmQDVrgfH8ud1ZHuRnLkySgQORAtjaQu2PbZa9ThFW5CiFhW9tjl+/8H8Ag==", BinaryEncoding.Base64), Compression.Deflate)), let _t = ((type nullable text) meta [Serialized.Text = true]) in type table [ID = _t, #"Created Date" = _t, #"Closed Date" = _t, Status = _t, #"Amount " = _t]),
#"Changed Type" = Table.TransformColumnTypes(Source,{{"Created Date", type date}, {"Amount ", type number}}),
#"Filtered Rows" = Table.SelectRows(#"Changed Type", each ([Status] = "Open")),
#"Removed Other Columns" = Table.SelectColumns(#"Filtered Rows",{"Created Date", "Amount "}),
#"Inserted Month Name" = Table.AddColumn(#"Removed Other Columns", "Month Name", each Text.Start(Date.MonthName([Created Date]),3) & " " & Number.ToText(Date.Year([Created Date]))),
#"Grouped Rows" = Table.Group(#"Inserted Month Name", {"Month Name"}, {{"Open Count", each Table.RowCount(_), Int64.Type}, {"Open Amount", each List.Sum([#"Amount "]), type nullable number}})
in
#"Grouped Rows"

PawelWrona
Helper III
Helper III

Hello, for the number of Open Cases you can go with following formula:

CALCULATE(DISTINCTCOUNT('Table'[ID]), 'Table'[Status] <> "Closed")
 
Similarly, for value of open cases you would do:
CALCULATE(SUM('Table'[Amount]), 'Table'[Status] <> "Closed")
 
To represent these values on a month level, would be good to have a Calendar table, linked to your [Created Date] column, so you have additional date values available llike month, quarter and year.
 
Please, let me know if this is what you needed.

This did work the way it's intended, but I realized the model I need, I additionally need is if the case was closed outside of the month the case was created, then this would be added into the "Open" amount 
For example: October would be $30 due to the one case being closed in November

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.

Top Solution Authors
Top Kudoed Authors