I am trying to mimic the Average field calculation in the below table, in Arcade. Anybody lend a hand?
For a field calculation, we're evaluating the expression per row of the table, and we only have to worry about matching values. By filtering the full layer based on the date field, you can easily get that subset, then use the Average function to get the numeric average of any field.
var fs = $layer var matching_ts = Filter(fs, `date_field = ${$feature['date_field']}`) return average(matching_ts, 'numeric_field')
Whether or not this works will depend on where the data is at, too. For some database providers, the timestamp needs to be wrapped in "timestamp '...'". Also, the variable $layer may not work there, so you may need to use a FeatureSet function to bring the rest of the layer's values in.
Signed in members can post, follow updates, and more. New here? Register a free account.
Find useful guides, FAQs, and documents to help you navigate and make the most of Esri Community.