Here is a formula that works with your Example data table. It has not been tested beyond that, so you may need to make some adjustments
Names Default To Here( 1 );
dt = New Table( "Example",
Add Rows( 9 ),
New Column( "Group", Character, "Nominal", Set Values( {"A", "A", "A", "B", "B", "B", "C", "C", "C"} ) ),
New Column( "Time", Numeric, "Continuous", Format( "Best", 12 ), Set Values( [1, 3, 8, 1, 2, 6, 1, 3, 7] ) ),
New Column( "Score",
Character,
"Nominal",
Set Values( {"Pass", "Fail", "Pass", "Pass", "Pass", "Pass", "Pass", "Fail", "Fail"} )
)
);
dt << New Column( "First Time Failed",
character,
formula(
If( Row() == 1,
dt = Current Data Table();
check = :Score;
If( :Group == :Group[2],
Failed = Char( Col Max( :Time, :Group ), Failed = :Score )
);
,
If( :Group == Lag( :Group ),
If( :Score == "Fail",
check = "Fail"
);
Failed = Char( Col Max( :Time, :Group ) );
,
If( check == "Pass",
lagGroup = Lag( :Group );
:First Time Failed[dt << get rows where( :Group == lagGroup )] = "Pass";
Failed = Char( Col Max( :Time, :Group ) );
);
check = :Score;
)
);
failed;
)
);
Jim