Select to view content in your preferred language

Dashboard indicator data expression to work with category selectors

1365
1
Jump to solution
10-18-2023 05:17 AM
Labels (1)
Tiff
by
Frequent Contributor

I have a dashboard and an indicator using a data expression that performs calculations on multiple fields. I was able to do so easily using the solution in this post. My summed variables does the calculation and the dictionary output sums the rest. This works great, but I want to be able to filter these using my category selectors and that is not doable with this script since it only outputs a total sum. Category selectors have a matching field in the indicator layer.

Any help is appreciated! I have tried using the GroupBy function for a different case but was not able to get it to output the dictionary in a way that would work and was not sure how to work with the GroupBy expression in the context of my script and the necessary output to be able to filter using the category selector.

Sample code below:

var fs = FeaturesetByPortalItem(Portal("https://www.arcgis.com"), "service id", 0, ["*"], false);

var sum1 = Sum(fs, 'SUM1') * 25
var sum2 = Sum(fs, 'SUM2') * 25
var sum3 = Sum(fs, 'SUM3') * 22
var sum4 = Sum(fs, 'SUM4')

var sumDict = {
'fields': [{'name': 'Total_Weight', 'type': 'esriFieldTypeInteger'}],
'geometryType': '',
'features':
[{'attributes':
{
'Total_Weight': (sum1 + sum2 + sum3 + sum4)
}}]};

0 Kudos
1 Solution

Accepted Solutions
Tiff
by
Frequent Contributor
0 Kudos
1 Reply
Tiff
by
Frequent Contributor

I resolved this question using another forum post solution with the GroupBy function:

https://community.esri.com/t5/arcgis-dashboards-questions/arcade-expression-for-dashboard-groupby-an...

0 Kudos