Hello Lars,
In response to your question- while this could be done with scripting, it is not necessary.
A column formula can create an indicator. From this select matching, where the Flag=1. Then Tables menu> Subset, selected rows....
I will use sample data file Big Class, with "Age" as an ID that has duplicates. This is a ordinal value, but the same formula will work with characters.
We will flag the Minimum "Height" within the group of similar "age" in a similar way that you are looking for the minimum "amount" per "ID"
These steps could be recorded with workflow builder in order to make a script.