I think Arcade is the route to take on this. I don't think we can make it dynamic, if that matters. Arcade has a function built in for standard deviation, but requires your values to be in an array, not a FeatureSet.
To make things easier on your dashboard, we can calculate all 4 things in one go.
var fs = FeatureSetByPortalItem(
Portal('your portal URL'),
'itemid of layer',
0, // layer index
['fields', 'you', 'need'],
false
)
// value array
var numbers = []
for (var f in fs) {
Push(numbers, f['field_you_are_calculating_stdev_for'])
}
// get standard deviation
var sdev = Stdev(numbers)
// mean
var mean = Average(numbers)
// output dict for indicators
var out_dict = {
fields: [
{name: 'stat', type: 'esriFieldTypeString'},
{name: 'value', type: 'esriFieldTypeDouble'}
],
geometryType: '',
features: [
{attributes: {stat: 'pos_one_stdev', value: mean + sdev}},
{attributes: {stat: 'pos_two_stdev', value: mean + (sdev * 2)}},
{attributes: {stat: 'neg_one_stdev', value: mean - sdev}},
{attributes: {stat: 'neg_two_stdev', value: mean - (sdev * 2)}}
]
}
return FeatureSet(Text(out_dict))
Once you've got that, you'll end up with a four-row FeatureSet with your values. Just set those indicators to Feature and filter each so that the relevant statistic is shown.
Apologies for the lack of formatting in the post. The site keeps insisting that there is invalid HTML in my post.
- Josh Carlson
Kendall County GIS