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

Calling all Data Engineers! Fabric Data Engineer (Exam DP-700) live sessions are back! Starting October 16th. Sign up.

Reply
bunny53
New Member

Getting rows with the same value

Hi, I need some help with getting a final status per each ID. The table is sorted by time, and IDs are composed of random alphabets and numbers. Currently a final status is in a string format like below. I created a look up table for each status, converting each status to a numerical value as I wished to be prioritized. What I want is, if operations for an ID has at least one "Complete", I want the table to say "yes", and otherwise(no Complete at all) "no". For example of ID "K304R" below, it operated three times with Status of "Completed", "Error", and "Canceled", and thus the result I want would be a "yes".

 

My intuition was 1) ALLEXCEPT original table with ID and Status, 2) somehow get rows with the same ID(ex "K304R"), 3) somehow get Status for each rows of "K304R", 4) somehow connect Status back to the look up table, 4) get Max value for statuses, 5) return "yes" if the max value is 100, and otherwise "no".

 

Any help would be really appreciated. Thanks ahead!

 

OriginalTable

TimeIDStatus
2022/10/4 10:47AM1ZT56Error
2022/10/4 9:47AMK304RCompleted
2022/10/4 7:47AMK304RCanceled
2022/10/3 10:47PM1ZT56Completed
2022/10/3 7:47AMPQ534Canceled
2022/10/3 4:47AM12PT3Error
2022/10/2 10:40PM12PT3Error
2022/10/2 7:47PM1ZT56Canceled
2022/10/1 10:47AMU73RLCompleted

 

LookupTable

StatusStatusVal
Completed100
Canceled0
Error0

 

Result I want

TimeIDStatusFinalStatus
2022/10/4 10:47AM1ZT56Erroryes
2022/10/4 9:47AMK304RCompletedyes
2022/10/4 7:47AMK304RCanceledyes
2022/10/3 10:47PM1ZT56Completedyes
2022/10/3 7:47AMPQ534Canceledno
2022/10/3 4:47AM12PT3Errorno
2022/10/2 10:40PM12PT3Errorno
2022/10/2 7:47PM1ZT56Canceledyes
2022/10/1 10:47AMU73RLCompletedyes
1 ACCEPTED SOLUTION
MarkLaf
Super User
Super User

Are you actually looking to leverage LookupTable for other reasons or is its only use to try to get the correct FinalStatus output?

 

It's actually easier to do this without a helper table. You were on the right track with ALLEXCEPT, but can skip a bunch of the steps you were envisioning by using CONTAINS:

FinalStatus =
CALCULATE(
    IF(
        CONTAINS( OriginalTable, OriginalTable[Status], "Completed" ),
        "yes",
        "no"
    ),
    ALLEXCEPT( OriginalTable, OriginalTable[ID] )
)

View solution in original post

1 REPLY 1
MarkLaf
Super User
Super User

Are you actually looking to leverage LookupTable for other reasons or is its only use to try to get the correct FinalStatus output?

 

It's actually easier to do this without a helper table. You were on the right track with ALLEXCEPT, but can skip a bunch of the steps you were envisioning by using CONTAINS:

FinalStatus =
CALCULATE(
    IF(
        CONTAINS( OriginalTable, OriginalTable[Status], "Completed" ),
        "yes",
        "no"
    ),
    ALLEXCEPT( OriginalTable, OriginalTable[ID] )
)

Helpful resources

Announcements
FabCon Global Hackathon Carousel

FabCon Global Hackathon

Join the Fabric FabCon Global Hackathon—running virtually through Nov 3. Open to all skill levels. $10,000 in prizes!

October Power BI Update Carousel

Power BI Monthly Update - October 2025

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

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.