Forum Discussion
ashrafkotb
Helper I
6 years agoHow to create a calculated column to subtract previous row value?
Hello, I need to create a calculated column that subtracts the current row value from the previous row value based on date and customer name. For example: Date Value Customer Calc_column (...
- 6 years ago
Hi ashrafkotb
try
Calc_column = var _thisDate = Table[Date] var _prevDate = CALCULATE(MAX(Table[Date]), ALLEXCEPT(Table, Table[Customer]), Table[Date] < _thisDate ) RETURN Table[Value] - CALCULATE(MAX(Table[Value]), ALLEXCEPT(Table, Table[Customer]), Table[Date] = _prevDate )
az38
Community Champion
6 years agoHi ashrafkotb
try
Calc_column =
var _thisDate = Table[Date]
var _prevDate = CALCULATE(MAX(Table[Date]), ALLEXCEPT(Table, Table[Customer]), Table[Date] < _thisDate )
RETURN
Table[Value] - CALCULATE(MAX(Table[Value]), ALLEXCEPT(Table, Table[Customer]), Table[Date] = _prevDate )- ashrafkotb6 years ago
Helper I
This worked, thank you.