These are insurance claims that are entered via a front end system. The issue is that as they are adding more transactions to each feature of a claim occurrence, they change the Peril, which they should not do.
I know this should be fixed in the front end, but for now we have to use what we have stored in the database. When we try to aggregate the data to the feature level, we need to only get 1 row for each combination of occurrence and feature with the Peril. But because their are 2 perils for the given occurrence/feature combination, we get multiple rows.
So our logic is to only use the peril that was entered during the last transaction of the occurrence/feature combination.