First, you want to sum up the invalid registrations (
invalidReg) by cityfor precincts that are already on the watchlist (
precinctWatchList = y). These sums are grouped by city, which can span multiple precincts:
invalidRegbyCityId column contains invalid registrations across the entire city.
Now, at the county level, you want to identify the number of precincts that were on the watch list and were part of a city-wide registration problem.
In the following step, the number of cities in each count are counted where invalid registrations within a city is greater than
- This step
- creates a pivot aggregation.