DS is not a procedural engine! Conceptually it deals with data in complete sets at a time. It does not "loop" through a table, you cannot drag values from a record to the following ones (the only exception is the built-in function previous_row_value that returns the column value of the previous record)...
The results you are looking for can easily be achieved though using the table_comparison transform. Next to the description in the official documentation you will find in this forum plenty of documents, blogs and discussions on this powerful transform.