Create a history

Good morning friend, I would like to ask for your help to create the following. I have the following RG where I show a list of people.


As you can see there is a part that says “Prestamo” and “Retencion” in that part I show the following pop where I save a total amount and an amount to reduce

The help I am asking for is how to do an automatic control that reduces the amount added to the retention rate to that total, but that does it every week from the moment it was created and saves a history each time it is executed.

I tried using “do every” but it runs on all lines and when it reaches 0 it doesn’t stop and saves negatives. Thanks for your help, have a good day