Hi @roopa g
need to calculate the current value based on previous value
Regarding the alternative way, you might use window function LAG to get previous rows.
To improve performance, please ensure that your table is properly indexed.
Best regards,
Cosmog
If the answer is the right solution, please click "Accept Answer" and kindly upvote it. If you have extra questions about this answer, please click "Comment".