I have a datatable in reporting services report with a single column which holds integer values.

I want to work out the integer difference + or - between the row and the previous row and display that value in a second column.

i.e
Col1 Col2
1 0
3 2
5 2
1 -4
8 7

I think it may be possible usine the code behind the report using a function but am unsure how to make it work.

I have made a start but am struggling with what im actually trying to do in code.

Any help please.
Code:
Function CalcChangeInAvailable(ByVal RecsTot As integer, ByVal RecsAvail As integer, ByVal rowNum as Integer) As Decimal

if rowNum <=0 then 
CalcChangeInAvailable = 0
else


redim RecordsAvailable(rowNum)

RecordsAvailable(rowNum) = RecsAvail
 
Recs = RecsAvail(rowNum-1) - rowNum
CalcChangeInAvailable = Recs
end if


End Function