I have a table with following data: computed column : current
| id | Date (dd/mm/yyyy) | Factor | Actual | Current |
|----|-------------------|--------|--------|----------|
| 1 | 04/01/2017 | 0.5 | 100 | 100 |
| 2 | 04/02/2017 | 0.5 | 120 | 100 |
| 3 | 04/03/2017 | 0.5 | 120 | 110 |
| 4 | 04/04/2017 | 0.5 | 115 | 115 |
| 5 | 04/05/2017 | 0.5 | 125 | 115 |
| 6 | 04/06/2017 | 0.5 | 100 | 120 |
| 7 | 04/07/2017 | 0.5 | 100 | 110 |
Current row = current of previous row + factor * (actual of previous row - current of previous row)
For id = 1, current = same as actual = 100
For id = 2, current = 100 + 0.5 * (100 - 100) = 100
For id = 3, current = 100 + 0.5 * (120 - 100) = 110
For id = 4, current = 110 + 0.5 * (120 - 110) = 115
and so on...
How to achieve in postgresql using query?