Assume you have a table T with the following structure:
| LABEL | CPTY | VALUE |
| BASE | A | 123.45 |
| STRESS | A | 234.56 |
| BASE | B | 345.67 |
| STRESS | B | 456.78 |
| BASE | C | 567.89 |
| STRESS | C | 678.90 |
| ... | ... | ... |
The columns (LABEL, CPTY) form a primary key of table T.
We want to get a table with IMPACT for each counterparty (CPTY), where IMPACT is defined as the difference of values between STRESS and BASE.
The expected structure of the table is:
| CPTY | IMPACT |
| A | ... |
| B | ... |