Hi Guys,
I have a requirement where in I have to calculate value of a Column on each row using the value of the same column from the previous row and using the calculated column in the next row in HANA SQL. Refer to the table for more clarity.
S.No | Demand | IntransitQty | Projected Stock | Required Output | |
1 | 10 | 22 | 33 | 33 | First row = Projected Stock 1st row |
2 | 20 | 0 | 0 | 33 + 0 - 20 = 13 | |
3 | 15 | 418 | 0 | 13 + 418 - 15 = 416 | |
so on.. |
Will appreciate if it can be done without using Cursor as I am creating a scripted view which is taking the values from Graphical CV and then modifying. Using cursor will screw the performance of the model.
Regards,
Mohan