Yes @Patrick your re-formulation seems right to me. Honestly at the end I made my task grouping by another variable that could be considered a proxy of what I asked to build with this question, obtaining results that seems acceptable. Anyway I add some other details about the problem if this could useful. The dataset that I am using collects banking accounts contracts. But the same banking account could be splitted in more than one record in the dataset. Essentially for two potential reasons (both could be present, just one of them, or none): - the banking account is splitted in more than one record because you have the secured part of the drown amount in a record, and the unsecured part in another record: the two or more records share the same ID contract (the variable RAPP that I provided previously) but they have different POSITION code (the variable POSIZ that I provided previously) - the banking account has a credit line with an undrown exposure (the credit not used by the counterpart). This undrown part insists on the credit line ID contract, not the banking account, so the two ore more records have different ID contract (again the variable RAPP). But the undrown part is always linked to only one banking account, sharing the same POSITION ID with one of its tranche (again the variable POSIZ). My aim would be to reaggregate all the records, to see the total undrown and drown amount overall.
... View more