Hi,
I have a table which looks like:
Id, Col1, Col2
1, X, 200
2, Y, 300
3, Z, 500
4, A, 150
5, B, 450
I want to achieve grouping/chunking based on a passed value and the sum of values equal or less than in col2 across rows.
For ex: if pass value is 600 the chunking should be like below:
Id, Col1, Col2, chunk
1, X, 200, 1
2, Y, 300, 1
3, Z, 500, 2
4, A, 150, 3
5, B, 450, 3