How do I perform arithmetic calculations between data in two different tables?

280
1
05-30-2020 05:30 PM
vinhhuyle
New Contributor

For example, I have one table with the total number of hospital beds in a given county. I have another separate table with the populations in those same counties. Therefore, in order to calculate "hospital beds per person" in a given county, I would have to take the hospital bed number in the first table and divide that by the population number in the second table. I have tried playing around with the "calculate field" tool but I am not familiar with Python or Arcade, and it seems like it can only perform calculations within a single table. Please advise and thank you for your time.

0 Kudos
1 Reply
curtvprice
MVP Esteemed Contributor

This is a very common Geoprocessing problem. Since you are using the Calculate Field tool, it sounds like you are using ArcMap or ArcGIS Pro‌. 

1. Add a field (beds per county, float) to table 1

2.  Use Add Join tool (or right click layer, joins and relates, Add Join) to join table 1 and table 2 by a common field (usually county FIPS code). After you set up the join, the fields in both tables will appear in the table view.

3. Calculate Field on your new field with an expression (using the language you are most familiar with, Python works with both ArcMap and Pro): example, 100.0 * !tbl1.BEDS! / !tbl2.POPULATION!