I’d have a hard time explaining this on phone but you could hack something together with row_number probably.
relevant: