One way would be to create formula using Lag and then you can get max value of that column
If(
Row() == 1,
counter = 1;
, Lag(:col, 1) != :col,
counter++
);
counter;
Maybe something like this could also work:
Col Cumulative Sum(Lag(:col) != :col)
-Jarmo