| Time | Agg | Value | Needed Value |
| --- | --- | --- | --- |
| 10:55:00 | 178.0 | 322.0 | 322 |
| 11:00:00 | 354.0 | - | (322-354)-32 |
| 11:05:00 | 354.0 | - | (-32-354)-386 |
| 11:10:00 | 354.0 | - | (-386-next Agg nu) |

How can I calculate the needed value field,

for 1st row it takes the value field as it is,

for 2nd row it takes 2nd row needed value - 3rd row Agg value

for 3rd row, 3rd row needed value -4th row agg