Select to view content in your preferred language

Calculate Field Issue

268
3
4 weeks ago
MarkAnderson6
Emerging Contributor

I am trying to calculate a field I created. The apparent glitch is as follows: The field has data points from two geographic extents. A recently created congressional district now has portions of two prior districts within its new boundaries. I am trying to show margin of victory in both old districts by one party. When I write the expression, it returns values only for one district and for the second district it returns zeroes. 

My expression is as follows:

$feature. GCON01XXX-$feature.GCON01YYY;

$feature.GCON03XXX-$feature.GCON03YYY

it is a valid expression, yet only returns the values for the first line of the expression. Is this calculation for both extents possible? If so, what syntax thing am I missing?

If not possible, how do I fix it to get the data I need for both extents?

 

Thanks in Advance

 

Mark

Tags (2)
0 Kudos
3 Replies
AyanPalit
Esri Regular Contributor

@MarkAnderson6 Seems doable and eager to help, but I don't understand the details.

The field has data points from two geographic extents - what field is this GCON01XXX or GCON01YYY? Perhaps a screenshot of the map and few rows of the data will help explain.

Ayan Palit | Principal Consultant Esri
0 Kudos
MarkAnderson6
Emerging Contributor

Thanks for the reply. Here is a screen print of my attribute table and a segment of my map showing the disparities. The fields you reference GCONXXX01 and GCONXXX03 (my typo in first post) are as follow: GCONXXX01, GCONXXX03 are the identifiers for General Election, candidate's truncated last name and party and 01 and 03 refers to Congressional district. I used the xyz as a redaction. The field Republican Margin of Victory is the one I created and the field I wrote the expression for. The data type for the field is double, numeric, no decimal places. 

Thanks in Advance,

 

Mark

Screenshot 2025-12-13 133502.png

 

 

0 Kudos
AyanPalit
Esri Regular Contributor

@MarkAnderson6 Thanks,  based on the additional info, there seems to be an issue with the data logic.

The calculation expression is simple, wherein it's looking at the 2 fields per district feature and calculating the difference. It is certainly possible to get results for both the district extents. This is working for your first district but not for the second.

Are you using the same set of fields for the second district? If so, check if the fields have proper values and there is no filter/selection excluding the calculation.  

Ayan Palit | Principal Consultant Esri
0 Kudos