Hi. I am using ArcGIS Pro 3.1.3. I have a table with columns for species, the month each species is most frequently recorded in, and the number of grid squares each species has been recorded from. I have sorted it ascending by month, then descending by grid squares. I want to select the top 5 species by number of grid squares recorded from, for each month (or less if that month has less than 5 species). For example, I would like to go from:
Species | Month | Squares |
A | 1 | 20 |
B | 1 | 20 |
C | 1 | 19 |
D | 1 | 18 |
E | 1 | 16 |
F | 1 | 10 |
G | 1 | 9 |
H | 2 | 40 |
I | 2 | 32 |
J | 2 | 28 |
K | 2 | 17 |
L | 2 | 10 |
M | 2 | 9 |
N | 3 | 20 |
O | 3 | 19 |
To
Species | Month | Squares |
A | 1 | 20 |
B | 1 | 20 |
C | 1 | 19 |
D | 1 | 18 |
E | 1 | 16 |
H | 2 | 40 |
I | 2 | 32 |
J | 2 | 28 |
K | 2 | 17 |
L | 2 | 10 |
N | 3 | 20 |
O | 3 | 19 |
Can anyone please help with this? I think the solution should be something similar to what is discussed in this thread - https://community.esri.com/t5/geodatabase-questions/select-maximum-values-in-select-by-attributes/m-... - but I haven't been able to adapt the SQL queries there to my needs. Also not sure what to do in the case of tied values...
Thanks!