Calculation on a dynamic table

I would need to do some calculations on a dynamic numbers of columns.
the dynamic columns are the ones named with a date. that number of columns will grow up to 13.
For now there are 3 and next month there will be 4 and so on up to 13.
Per row, I need to calculate the difference between each of them and add this difference to each other.
e.g.: (7630 - 7627) + (7627-7622) = 8

Any help is greatly appreciated!

"normally" they would be Rows, in a child-table, and not columns. That then makes it easy to process them (i.e. without needing a dynamic method)