I have this formula but it is adding the value on the same row.
If(
:Column 2 != Lag( :Column 2 ) | Row() == 1, :Column 1,
Row() == 2 | Lag( :Column 2, 1 ) != :Column 2, :Column 2 - (:Column 1 + Lag( :Column 1, 1 )),
Lag( :Result ) - :Column 1
)
What I would want to do is something like this:
Column 1 and Column 2 are given values. If Column 2 value changes, the result should be like the starting value in Column 1.
| Column 1 | Column 2 | Result | (should be computation) |
| 10 | 20 | 10 | same value in Column 1 |
| 2 | 20 | 10 | Column 2 - Column 1 row 1 (20-10) |
| 5 | 20 | 8 | Column 2 - Column 1 rows 1 to 2 (20 - 12 +2) |
| 3 | 20 | 3 | Column 2 - Column 1 rows 1 to 3 (20 - 12 +2 +5) |
| 2 | 15 | 2 | |
| 1 | 15 | 13 | |
| 3 | 15 | 12 | |
| 4 | 15 | 9 | |
How can I create a table equation like this?