I have a dataset with start and end time. From this, I have created a DataExpression with a field for elapsed time in minutes per feature, and a User field. I am using this in an indicator to sum up the total time, and I have a category selector to filter it per User. This works fine, but what I want is to show the elapsed time in hours:minutes for all features summed up, while still being able to filter it per user from the category selector.
I tried Arcade expressions using this method, but it creates one indicator view per feature, and not summed up for all features.
I cannot think of a good solution, unless I sum up all minutes for all features already in the DataExpression, but I am not sure if this is a good idea. Help me think, how could I best do this?
The DataExpression looks like this:
var fs = FeatureSetByPortalItem(p, 'itemID', 0, ['start_time', 'end_time', 'created_user'], false);
// Create array for holding features, feat object for populating array
var features = [];
var feat;
// Populate feature array
for (var feature in fs) {
Console(feature)
feat = {
'attributes': {
'user': feature['created_user'],
'minutes': Floor(DateDiff(feature['end_time'], feature['start_time'], 'minutes))
}}
Push(features, feat);
};
var dowDict = {
'fields': [{ 'name': 'user', 'type': 'esriFieldTypeString'},
{'name': 'minutes', 'type': 'esriFieldTypeInteger'}],
'geometryType': '',
'features': features
};
return FeatureSet(Text(dowDict));