How to find max for last 5 rows on a column and loop through entire table


I am trying to find out the max, min, average, median value of a column of data, starting from the top and doing this for preceding 5 rows of data.  The 5 rows is arbitrary and may change to 10 rows, 20, 60 and so on.  Cannot group the rows as there is no commonality in preceding row data in any column.  So its a rolling interval for every record and the stats needed are max, min average.  Any help would be appreciated.  Thanks

i may have just found the answer.  its the moving aggregation node where i can do this i believe.