Define a number field in your portal's table and set it to auto-enter this calculated result:
let ( R = Get ( recordNumber ) ;
if ( R > 1 ; DueDate - GetNthRecord ( DueDate ; R - 1 ) )
) // let
I have created a number field called "Days since last activity" using the auto enter calculation shown above however the field does not return a number, it remains blank. There are 3 record in the portal.