Is it possible to create an indicator or list that sums up the values from existing indicators within the dashboard? I have been trying with arcade in a data expression but am not having any luck. For instance, my dashboard contains Indicator1, Indicator2, and Indicator3. I would like to find the sum of Indicators 1,2 and 3 and display the results in a new indicator (Indicator4) or in a new list etc.
I have a fair amount of indicators on different tabs within the dashboard and each has a somewhat long filter applied, so I’m hoping to make it easy by referencing the existing indicators to find the sum. The indicators are all referencing the same data source and I’m in ArcGIS Online
Thank you!
Melissa
Solved! Go to Solution.
Not directly, no.
What you could do: Instead of referencing a layer/expression and doing the filtering and grouping in the Indicator widgets, you could create an expression that returns a featureset with two fields: an indicator id and the corresponding value. Then, each Indicator widget would only have to filter for its id and display the value.
Something like this:
var fs = FeaturesetByPortalItem(...)
var out_fs = {
geometryType: "",
fields: [
{name: "Indicator", type: "esriFieldTypeString"},
{name: "Value", type: "esriFieldTypeDouble"},
],
features: []
}
// Indicator 1:
var v = Count(Filter(fs, "Field = 123"))
Push(out_fs.features, {attributes: {Indicator: "count of 123", Value: v}})
// Indicator 2:
var v = Count(Filter(fs, "Field = 345"))
Push(out_fs.features, {attributes: {Indicator: "count of 345", Value: v}})
// ...
return Featureset(Text(out_fs))
And for the final Indicator, you could just use the SUM of the Value field.
Of course, that would require you to edit all the other Indicator widgets, so it might be easier to just redo the filter for the final Indicator...
Not directly, no.
What you could do: Instead of referencing a layer/expression and doing the filtering and grouping in the Indicator widgets, you could create an expression that returns a featureset with two fields: an indicator id and the corresponding value. Then, each Indicator widget would only have to filter for its id and display the value.
Something like this:
var fs = FeaturesetByPortalItem(...)
var out_fs = {
geometryType: "",
fields: [
{name: "Indicator", type: "esriFieldTypeString"},
{name: "Value", type: "esriFieldTypeDouble"},
],
features: []
}
// Indicator 1:
var v = Count(Filter(fs, "Field = 123"))
Push(out_fs.features, {attributes: {Indicator: "count of 123", Value: v}})
// Indicator 2:
var v = Count(Filter(fs, "Field = 345"))
Push(out_fs.features, {attributes: {Indicator: "count of 345", Value: v}})
// ...
return Featureset(Text(out_fs))
And for the final Indicator, you could just use the SUM of the Value field.
Of course, that would require you to edit all the other Indicator widgets, so it might be easier to just redo the filter for the final Indicator...
@JohannesLindner Thank you!!!
What do you think the best course of action would be in this situation if I wanted the final sum indicator(s) to be able to be filtered by two Category Selectors (year and district name)? All of the individual indicators that are used to sum up into the final indicators, are also actioned to be filtered by the same two Category Selectors (year and district name). As I have it now, if the Category Selector(s) are applied to filter the individual indicators, the 'final sum' indicators are not being filtered which is confusing to the user.
Thanks again--I really appreciate the help!!
In that case, I believe you're stuck with creating the filter in the widget.
Hi @JohannesLindner
I have been trying to create a sum indicator based on your suggestions, and I want to populate this sum value corresponding to map extent. But the value does not change when I change map extent. Can you take look on my expression? I'm very new to this. Many thanks!
Hello,
I’m trying to write an expression in the dashboard to add two layers in a certain field (n_lobitos in both)
I’m not getting it. Any help?
I’ve seen the sample below but it’s different.
https://github.com/Esri/arcade-expressions/blob/master/dashboard_data/CalculationAcrossFields.md
----------------------------------------------------------------------------------