I did a one to many spatial join and ended up with an attribute table as follows: Lets say we have 5 different IDs that have numerical values in 500 rows. I need to sum the values for each ID, and end up with 5 rows of data containing the ID and the total of all values that had that ID. Is group by the right tool for this? If so, how exactly do I use it?

Please note that these numbers are simplified and the actual number of rows is much larger.

  • can I do that in the spatial join one to one (instead of one to many) and sum that field in specific for all intersections with the same ID? – Solaire Oct 16 '14 at 20:40
  • 3
    This question is essentially a duplicate of any number of questions dealing with grouping/summarizing data: gis.stackexchange.com/questions/95803/…, gis.stackexchange.com/questions/102507/… – phloem Oct 16 '14 at 21:05
  • okay so the answer to them is using summary statistics.... I knew the tool existed. I just don't know how to utilize it in my case, which is clearly different from both cases. – Solaire Oct 17 '14 at 12:57

You can use the Dissolve tool.

You choose the dissolve field (ID) and then SUM for the statistics.

  • thanks for sharing, from the looks of it the dissolve tool can be helpful when dealing with huge tables (hundreds of thousands of rows). – Solaire Oct 17 '14 at 20:06

If you are only interested in the attribute table, you can use the Summary Statistics tool, where 'Statistics Fields' = fields to sum, 'Statistics Type' = SUM, and 'Case Field' = ID.

  • I guess I could join that to the original shapefile – Solaire Oct 17 '14 at 13:02

Right click the field and choose "Summarize" then choose your field and the method by which to summarize that field. Sum is what you are looking for.

Not the answer you're looking for? Browse other questions tagged or ask your own question.