• Statistically speaking you want the first quartile, so borrowing on Matt's solution I would just shift a few things to make it intuitive ...

    with MYcte as (

    selectMAINGROUP,vALUE, NTILE(4) OVER (PARTITION BY MAINGROUP ORDER BY VALUE ASC) AS NTILE_GROUP

    FROM#MYtABLE

    )

    select MAINGROUP, VALUE, NTILE_GROUP AS FIRST_QUARTILE

    FROM MYcte WHERE NTILE_GROUP=1

    Here in your code imples you want the first quartile, the bottom 25%. That keeps confusion from setting in when you read your code in four months 😎

    ----------------------------------------------------