i have built adoc which i use previous row to get my calculation from previous row
i have column name items and columns name pay number
i sort table by items and pay numbers
formula works when pay number less than 10
and get wrong sort when number more than 10
formula
thisTable.Filter(Items=thisRow.Items)
.Sort(false(),thisTable.[Pay No]) .
Filter((Concatenate(Items,[Pay No] )<=
Concatenate( thisRow.Items,thisRow.[Pay No]))
&&[Row ID]!=thisRow.[Row ID] ).
[Row ID].First()
screenshot
my doc
my table