Very difficult to very by myself, please check.
Your calculation took a raw ID into consideration, but the data does not have raw-ID.
Tableau cannot judge the Row-ID sorting order without Raw ID, then I added Raw-ID as data source.
Without this, you cannot replicate this at all.
excel_formula_SM_18.2.twbx 23.0 KB