Calculate price difference

I have a function field in an entity. What is the best way to calculate the difference between the price in the current record and the price from the previous record? Using the Deduct function with a lookup field showing the price of a record with the newest RecordCreated value that is lower than RecordCreated of the current record?

This is not a good use case for a function field. It is actually not a good use case even for a rule as the rules do not see sibling records. Or this is how I understand it from your description.

Can you describe the use case in more detail? Why would anyone need to calculate such value and how are the records structured?

Given the output is static I’d recommend using workflow method where you can comfortable preprocess data.

It is for a screen where you see contracts and their amendments with different prices and the column should show the price difference between the previous and current value for each row.