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

The Power BI DataViz World Championships are on! With four chances to enter, you could win a spot in the LIVE Grand Finale in Las Vegas. Show off your skills.

Reply
DMB90
Frequent Visitor

If Any Row with a Specific ID contains "Closed" then Return "Closed" Value in All Rows for ID

I have a column with a specific ID listed several times and I'm trying to check if any row with a specific ID contains a "Closed" status and if so mark it as "Closed" but if all rows with a specific ID are blank in status, then mark it as "Open" in the newly created column.

1 ACCEPTED SOLUTION
v-kongfanf-msft
Community Support
Community Support

Hi @DMB90 ,

 

You can try below formula to create calculated column:

Status Result = 
VAR CurrentID = 'YourTable'[ID]
VAR ClosedCheck = 
    CALCULATE(
        COUNTROWS('YourTable'),
        FILTER(
            'YourTable',
            'YourTable'[ID] = CurrentID &&
            'YourTable'[Status] = "Closed"
        )
    )
RETURN
    IF(
        ClosedCheck > 0,
        "Closed",
        "Open"
    )

vkongfanfmsft_0-1715307053360.png

 

Best Regards,
Adamk Kong

 

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

View solution in original post

2 REPLIES 2
v-kongfanf-msft
Community Support
Community Support

Hi @DMB90 ,

 

You can try below formula to create calculated column:

Status Result = 
VAR CurrentID = 'YourTable'[ID]
VAR ClosedCheck = 
    CALCULATE(
        COUNTROWS('YourTable'),
        FILTER(
            'YourTable',
            'YourTable'[ID] = CurrentID &&
            'YourTable'[Status] = "Closed"
        )
    )
RETURN
    IF(
        ClosedCheck > 0,
        "Closed",
        "Open"
    )

vkongfanfmsft_0-1715307053360.png

 

Best Regards,
Adamk Kong

 

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

The column for ID I need is already a measure and won't register. It's called "commentable_id" and is a measure and set to whole numbers.

Helpful resources

Announcements
Las Vegas 2025

Join us at the Microsoft Fabric Community Conference

March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount!

Feb2025 Sticker Challenge

Join our Community Sticker Challenge 2025

If you love stickers, then you will definitely want to check out our Community Sticker Challenge!

Feb2025 NL Carousel

Fabric Community Update - February 2025

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