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

Vote for your favorite vizzies from the Power BI Dataviz World Championship submissions. Vote now!

Reply
Anonymous
Not applicable

Flag all rows if one row fails for same unique ID

I need help with the following (just have put random columns to mimic my situation)

I have the first 4 columns of data and want to insert a fifth column labelled "Fail"

 

I am struggling to figure out a formula to apply, but want to basically say that if a person (ID) works in multiple departments, and if any of the rows comes back as "at risk ie. below <80% efficiency", then return Y(yes) in the fail column for all instances, even those that have efficiency >80.

 

Any suggestions?

 

ID

Deparment

 Efficiency (%)

At Risk

Fail

ABCD

 1

 <80

Y

Y

ABCD

 2

 <90

N

Y

ABCD

3

<40

Y

Y

DEF

1

<90

N

Y

DEF

2

<60

Y

Y

GHD

1

<90

N

N

GHD

2

>90

N

N

2 ACCEPTED SOLUTIONS
v-piga-msft
Resident Rockstar
Resident Rockstar

Hi @Anonymous ,

To achieve your desired output, please create the two calculated column below.

Please note that you need to change the column type to be Whole number after creating it.

Column = RIGHT('Table1'[Efficiency(%)],2)
Fail =
VAR ATRISK =
    CALCULATE (
        COUNTROWS ( Table1 ),
        FILTER ( Table1, Table1[ID] = EARLIER ( Table1[ID] ) && Table1[Column] <= 80 )
    )
RETURN
    IF ( ATRISK > 0, "Y", "N" )

Here is the output.

Capture.PNG

Hope this can help you!Smiley Happy

Best Regards,

Cherry

 

Community Support Team _ Cherry Gao
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

Anonymous
Not applicable

Thanks for that response, looks to work.

I just figured out a solution myself

I changed the AtRisk column from N/Y to 0/1

 

Then created a formula:

Fail = CALCULATE(MAX(Data[At Risk]),ALLEXCEPT(Data,Data[ID]))

 

This also gave me my desired solution

View solution in original post

4 REPLIES 4
BigDaddyLinda
Frequent Visitor

Is possible to achieve the same thing in Power Query?

v-piga-msft
Resident Rockstar
Resident Rockstar

Hi @Anonymous ,

To achieve your desired output, please create the two calculated column below.

Please note that you need to change the column type to be Whole number after creating it.

Column = RIGHT('Table1'[Efficiency(%)],2)
Fail =
VAR ATRISK =
    CALCULATE (
        COUNTROWS ( Table1 ),
        FILTER ( Table1, Table1[ID] = EARLIER ( Table1[ID] ) && Table1[Column] <= 80 )
    )
RETURN
    IF ( ATRISK > 0, "Y", "N" )

Here is the output.

Capture.PNG

Hope this can help you!Smiley Happy

Best Regards,

Cherry

 

Community Support Team _ Cherry Gao
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Anonymous
Not applicable

Thanks for that response, looks to work.

I just figured out a solution myself

I changed the AtRisk column from N/Y to 0/1

 

Then created a formula:

Fail = CALCULATE(MAX(Data[At Risk]),ALLEXCEPT(Data,Data[ID]))

 

This also gave me my desired solution

I'd argue your soluton is better and more elegant. 

Helpful resources

Announcements
Power BI DataViz World Championships

Power BI Dataviz World Championships

Vote for your favorite vizzies from the Power BI World Championship submissions!

Sticker Challenge 2026 Carousel

Join our Community Sticker Challenge 2026

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

January Power BI Update Carousel

Power BI Monthly Update - January 2026

Check out the January 2026 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.