I need to show minimum and maximum values for a series of measurements associated with unique location.
I thought "max" and "min" would do the trick, but for both lists and indicators, I am only getting a result for each record.
Both the list and the indicator are filtered and should have a discreet number of records that I would like to get statistics for.
Is it possible to do this? I have a bad feeling that I am overlooking something obvious 😞
Thank you for your time,
Randy McGregor
Solved! Go to Solution.
So if we had a data expression that grouped the records per-location, that could be enough? Try something like this, then set the indicator to Features. This should give you the three statistics for a given location. It won't aggregate across multiple locations, though, if that's an issue.
var fs = FeatureSetByPortalItem(
Portal('url'),
'itemID',
1, // or whatever layer index this table is at. I'm assuming it's a related table?
['measurement-field', 'location-id'],
false
)
return GroupBy(
fs,
'location-id',
[
{
name: 'minimum',
expression: 'measurement-field',
statistic: 'MIN'
},
{
name: 'maximum',
expression: 'measurement-field',
statistic: 'MAX'
},
{
name: 'average',
expression: 'measurement-field',
statistic: 'AVG'
}
]
)
An indicator should be able to show the min / max for multiple features without the need for Arcade at all. How do you have your indicator configured?
Thank you for your reply. An indicator can do this for one chosen statistic when you select 'statistic' rather than 'feature' . I can make three indicators (one for max, one for min, and one for avg), and that would not be bad. Trying to avoid that, but may end up doing that.
I would like to enter the min value at the top, the avg value in the middle and the max value at the bottom, of the indicator, but this seems to just act on the current record.
Ah, yes. You could get two statistics using a reference value, but to get all three in one indicator, you'd need to use a Data Expression.
Are you hoping to make this indicator interactive and filterable by feature selections elsewhere?
Yes, the indicator needs to be interactive. The dashboard is filtered by a url parameter configured in the dashboard, and needs to show results for the selected location.
Thank you,
Randy McGregor
So if we had a data expression that grouped the records per-location, that could be enough? Try something like this, then set the indicator to Features. This should give you the three statistics for a given location. It won't aggregate across multiple locations, though, if that's an issue.
var fs = FeatureSetByPortalItem(
Portal('url'),
'itemID',
1, // or whatever layer index this table is at. I'm assuming it's a related table?
['measurement-field', 'location-id'],
false
)
return GroupBy(
fs,
'location-id',
[
{
name: 'minimum',
expression: 'measurement-field',
statistic: 'MIN'
},
{
name: 'maximum',
expression: 'measurement-field',
statistic: 'MAX'
},
{
name: 'average',
expression: 'measurement-field',
statistic: 'AVG'
}
]
)
I missed this response. Thanks for this. This looks interesting. I'll see if it works. I need to provide these three numbers for whatever location a user selects. Currently, I have added these fields to the input with a summarize/join field combination. I think this will work fine. I appreciate your help.
Had a chance to look at this, and this will work for me. Thank you very much for your help.