Hello,
I'm having trouble using the Average and Mean function in an attribute rule. I am intersecting points with a polygon being inserted/updated and wish to get the average of a field value from all intersecting points. I am able to use the Sum and Count functions just find and my current workaround is to use both to get the Average.
When I use Average or Mean, I first got an error about how the field name was used to run the function. I was able to fix that by calling it differently (you can see the difference in the expression below).
The error I am getting now is below.

My Arcade expression:
var cpm_field = "Counts_Per_Minute"
var fsGS = FeatureSetbyName($datastore, "sde.blah.Gamma_Survey",[cpm_field],true)
var fsGSIntersect = Intersects(fsGS ,$feature)
var result_avg = null
if (Count(fsGSIntersect) == 0)
return result_avg ;
else
//result_avg = Sum(fsGSIntersect,cpm_field)/Count(fsGSIntersect) My workaround
//result_avg = Mean(fsGSIntersect,cpm_field) Does not work
result_avg = Mean(fsGSIntersect,fsGSIntersect[cpm_field])
return result_avg ;