It can be done with a column formula. I don't know how your data is arranged but if all values are in a single column you can combine the Col Sum() function with the desired condition as in the example below (3rd column).
New Table( "Example",
Add Rows( 25 ),
New Column( "Lot", Character,
Set Values(
{"A", "A", "A", "A", "A", "A",
"B", "B", "B", "B", "B", "B", "B", "B", "B", "B", "B", "B",
"C", "C", "C", "C", "C", "C", "C"})
),
New Column( "Values", Formula( Random Integer( 10 ) ) ),
New Column( "N_outside", Formula( Col Sum( :Values < 2 | :Values > 5, :Lot ) ) )
) << summary( Group( :Lot ), Mean( :N_outside ) );