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

Get Fabric Certified for FREE during Fabric Data Days. Don't miss your chance! Request now

Reply
Anonymous
Not applicable

Retrieve Case ID for cases with most recent status 'Bad'

Hi Guys,

 

Im trying to retrieve the most recent case ID's with status "bad" per business domain.

 

Data sample:

 

Domain - ID- Status - Date

Domain A -101 - Bad - 01-01-2019

Domain A - 101 - Bad - 02-01-2019

Domain A -101 - Good - 03-01-2019

Domain B - 102 - Good - 01-01-2019

Domain B - 103 - Good - 01-01-2019

Domain A - 104 - Bad - 01-01-2019

 

The end result for the data sample above would be:

Bad Cases Domain A: 104

Bad Cases Domain B: 

Since case ID 101 was eventually completed, this should not be counted as we take the most recent status.

 

I have tried the following two measures but that does not result in the correct ID's for status 'Bad'.

Could you please provide any suggestion?

 

Names of Bad Cases =
CONCATENATEX (
    FILTER (
        VALUES ( Table1[ Item Identifier ] ),
        CALCULATE ( COUNTROWS ( Table1 ) )
            = CALCULATE ( COUNTROWS ( Table1 ), Table1[ Status ] = "Bad" )
    ),
    [ Item Identifier ],
    ", "
)

 

Count of Bad Cases =
COUNTROWS (
    FILTER (
        VALUES ( Table1[ Item Identifier ] ),
        CALCULATE ( COUNTROWS ( Table1 ) )
            = CALCULATE ( COUNTROWS ( Table1 ), Table1[ Status ] = "Bad" )
    )
) + 0

 

3 REPLIES 3
ElenaN
Resolver V
Resolver V

Hello,

 

In order to get the correct IDs that have a current "Bad" status you can create a new measure as follows:

 

Max_Status = 
VAR MaxDatePerDomainAndID = CALCULATE ( MAX ( 'Status'[Date] ), ALLEXCEPT ( 'Status', 'Status'[Domain], 'Status'[ID] ) )
RETURN
LOOKUPVALUE('Status'[Status], 'Status'[Date], MaxDatePerDomainAndID)

 

Regards,

ElenaN

Anonymous
Not applicable

Thank you for your reply.

 

Perhaps I did not explain it well enough: What I am looking for is a list (the individual ID's) of all bad cases per domain. 

 

So the results would be:

Domain A Bad Status: Case X, Case Y, Case Z

Domain B Bad Status: Case A, Case B

 

Your solution is also useful but only provides the latest case's status per domain. Do you have any other suggestions?

Hi @Anonymous,

What is your desired result? If you want below desired table, you could refer this formula:

Create a calculated table:

Name of bad cases = SUMMARIZE('Table1','Table1'[Domain],"ID",CONCATENATEX(CALCULATETABLE('Table1','Table1'[Status]="Bad"),'Table1'[ID],","))

Result:

1.PNG

If I misunderstand you, could you please post a desired picture if possible.

Also you could download my pbix file to have a view.

 

Regards,

Daniel He

Community Support Team _ Daniel He
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

Helpful resources

Announcements
November Power BI Update Carousel

Power BI Monthly Update - November 2025

Check out the November 2025 Power BI update to learn about new features.

Fabric Data Days Carousel

Fabric Data Days

Advance your Data & AI career with 50 days of live learning, contests, hands-on challenges, study groups & certifications and more!

FabCon Atlanta 2026 carousel

FabCon Atlanta 2026

Join us at FabCon Atlanta, March 16-20, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.

Top Solution Authors
Top Kudoed Authors