How to add last previous value to estimation

Hi,

i’ve got the first four columns of following table as input and would like to create the last three as output.
So far I got it working for total columns if i put id in pages, but i don’t know how to access the last value (per id) from column “real”.

I hope someone has a hint for me.

id date capa real total capa total real preview (last value from column “real” + current kapa)
101 01.01.2019 300 250 300 250
101 05.01.2019 50 50 350 300
102 10.01.2019 100 80 100 80
101 15.01.2019 50 60 400 360
103 20.01.2019 200 150 200 150
102 25.01.2019 100 80 200 160
102 30.01.2019 100 - 300 - 260
102 04.02.2019 100 - 400 - 360
103 09.02.2019 200 - 400 - 350
101 14.02.2019 50 - 450 - 410