You can also use Col Moving Average() to get the value from previous row (can make it easier when working with group columns)
Names Default To Here(1);
// sample data
dt = New Table("Untitled",
Add Rows(6),
Compress File When Saved(1),
New Column("Meter", Character, "Nominal", Set Values({"A", "A", "A", "B", "B", "B"})),
New Column("Time", Numeric, "Continuous", Format("Best", 12), Set Values([1, 2, 3, 1, 2, 3])),
New Column("Value", Numeric, "Continuous", Format("Best", 12), Set Values([1, 0, 2, 0, 1, 2]))
);
// Data should be sorted by time
dt << New Column("D", Numeric, Continuous, Formula(
:Value - (Col Moving Average(:Value, 1, 1, 0, Meter) * 2 - :Value)
// 2 * :Value - (Col Moving Average(:Value, 1, 1, 0, Meter) * 2
));
-Jarmo