I have my data like this:
item - initial_value - amount - dateofpurchase
A 100 -3 2018-11-22
A 100 -2 2018-11-22
B 200 -5 2018-11-22
B 200 6 2018-11-22
B 200 -1 2018-11-22
(everything is ordered by date and time)
I want to calculate this column, that shows how much stock do you have after each step and taking in count the last amount
item - initial_value - amount - dateofpurchase - cumulative
A 100 -3 2018-11-22 97
A 100 -2 2018-11-22 95
B 200 -5 2018-11-22 195
B 200 6 2018-11-22 201
B 200 -1 2018-11-22 200
I've been trying a sum function with unbounded preceding and current row with no luck