I have the following 2-column table:
Threshold Duration
1 1
1 2
1 1
0 1
0 2
1 1
1 3
I would like to create a column with running total of 'Duration' column which would start from 0 whenever the value of 'Threshold' column changes i.e.:
Threshold Duration Total
1 1 1
1 2 3
1 1 4
0 1 1
0 2 3
1 1 1
1 3 4
Thanks