Select to view content in your preferred language

Field calculator, sum of field.

17976
10
Jump to solution
01-07-2015 10:22 AM
BenjaminMittler
Frequent Contributor

I am having a bit of a problem with what seems like should be a simple field calculator expression. I have a table with about 50 rows and a column with acres for each row. I've created a new column called Percent_Acres (Double) and im looking to calculate the percent each feature makes up of the total acres.

I want an expression equal to this Percent_Acres = Acres / Total Acres.

Normally this would be easy to do and i would just look up the field statistics for the sum. However this calculation is part of a model that will be automated so i need an expression that will automatically calculate the columns sum while in the field calculator.

It appears that i am having a problem with iterating through each row to add up to the total. I have tried numerous expressions and each time i get the same result telling me that "typeerror float object is not iterable"
"

Any advise on this topic would be greatly appreciated

Thanks, Ben

10 Replies
JuneSkeeter
Emerging Contributor

This is absurd ... is this really the easiest way to sum a field in the field calculator?  Why doesn't something like this work:

!Shape_Area!/!Shape_Area!.sum()