Using Portal row number in a calculation

I have an Invoice form with an InvoiceItems list in a portal (but it could be a list in a TabPanel)

I sort the portal/list by InvoiceItem Value, and want to display and apply a discount based on position, ie

Item in row 1 - 0%
Item in row 2 - 10%
Item in subsequent rows - 20%

As new items are added, the portal/list needs to resort (by item value) and re-apply the discount accordingly.

What’s the best way to achieve this?