I need to generate an increment field based on the difference bettwen current and previous value from another field:
So for example, this table would look like this:
I have this data in postgresql and my query is currently generating the table in first image, but I need it to create the second one.
Would be thankful for any hints.

