Here is a generalized solution inspired by (aka largely stolen from) this answer by @MrXSquared here: Make "quantile" classification with an expression
WITH_variable( 'percentile', array_find(array_agg("field1",order_by:="field1"),"field1") / array_length(array_agg("field1")), CASE WHEN @percentile <= 0.25 THEN '0-25%' WHEN @percentile <= 0.5 THEN '25-50%' WHEN @percentile <= 0.75 THEN '50-75%' WHEN @percentile <= 1 THEN '75-100%' ELSE 'Undefined' END )
with_variable(
'percentile',
array_find(array_agg("field1",order_by:="field1"),"field1") / array_length(array_agg("field1")),
CASE
WHEN @percentile <= 0.25 THEN '0-25%'
WHEN @percentile <= 0.5 THEN '25-50%'
WHEN @percentile <= 0.75 THEN '50-75%'
WHEN @percentile <= 1 THEN '75-100%'
ELSE 'Undefined'
END
)