Hello everyone,
I am trying to calculate the difference between records in a column and output the result in a new column. The formula needs to compare the records having the same Entity and the same Code. The calculation is basically :
If ENTITY=ENTITY and CODE=CODE then diff= amount of current month - amount of last month.
I just don't know how to write the formula for the calculation of the difference. Does anyone have an idea? Thanks!
Here is the input :

and what the output shoud look like:
