Imagine you have the following table:
If you run a FirstSortedValue(FieldA, FieldB) you'll get the first sorted value from FieldA based on the sorting of FieldB. Value 1 is the first value for FieldB so the function will in this example return C. (FirstSortedValue())
So if we keep "-" before the field B, it will be sorted in reverse order, returning B which is value for Max value in FieldB.
Same is the case with PaidDate(field B) and outstanding(Field A).
And again set analysis is applied to filter the values based on FieldB.