Hello,
I'm trying to figure out a multi-step filtering logic for my data:
| ID | Affected by | Type | Weight |
| 1 | A | inactive | 0.6 |
| 1 | B | active | 0.4 |
| 2 | C | inactive | 1 |
| 3 | A | inactive | 0.4 |
| 3 | B | active | 0.2 |
| 3 | D | active | 0.4 |
I would like to keep rows under the following criteria:
- if they are unique --> keep row for ID 2
- if ID is a duplicate then keep if there's a single Type = "active"
- if ID is a duplicate and there are multiple Type = "active" then keep the one with the highest value under Weight
The resulting table should thus be:
| ID | Affected by | Type | Weight |
| 1 | B | active | 0.4 |
| 2 | C | inactive | 1 |
| 3 | D | active | 0.4 |
Thank you for your help!