Arcade expression to locate matching records and produce total numeric values based on another field

169
2
01-04-2022 01:46 PM
Labels (1)
DannySmith12
New Contributor II

Hello all,

I'm attempting to create an arcade expression to do the following:

  • Find all matching records based on a unique identifier (County ID)
  • Use the matched records to find associated and varied acreage values
  • Calculate a total for the associated and varied acreage values

DannySmith12_0-1641332615190.png

 

Any insight will be greatly appreciated! Thank you.

0 Kudos
2 Replies
JohannesLindner
MVP Regular Contributor
// load the feature set using an appropriate FeatureSetBy* function
// see FeatureSetByID and below:
// https://developers.arcgis.com/arcade/function-reference/data_functions/#featuresetbyid
var fs = FeatureSetBy*(...)

// filter the feature set by county ID
// your scrrenshot shows field aliases, not names, check that I guessed the right name
var county_id = $feature.CountyID
var fs_county = Filter(fs, "CountyID = @county_id")

// return the sum of field "Acres"
return Sum(fs_county, "Acres")

Have a great day!
Johannes
0 Kudos
DannySmith12
New Contributor II

This was a great help. Thank you Johannes!

0 Kudos