Indicator Sum of Product of Two Fields

567
2
11-30-2020 03:46 PM
MatthewBradbury
New Contributor III

I am trying to create an indicator that shows the sum of a product of two fields. I am able to show this value for each feature using Arcade, but I haven't figured out how to multiple the fields and then sum them. The records contain a decimal distance field as well as an integer field representing the number of people who walked that distance. The indicator would show a sum of all of the products (distance * people).

Example:

Record 1: 2.0 miles * 2 people = 4.0 miles
Record 2: 1.0 miles * 3 people = 3.0 miles
Record 3: 4.0 miles * 2 people = 8.0 miles

Indicator: 4.0 miles + 3.0 miles + 8.0 miles = 15.0 miles

0 Kudos
2 Replies
VivekMalleshappa
Esri Contributor

Hi Matthew, 

The intermediate result approach you are trying is not available in the Indicator element.  That's because Indicators either work on individual feature values or statistics across layers. Arcade in Indicators also follow this pattern. 

As a workaround, if you own the layer, you could create a new field to store the (distance * people) calculation (https://doc.arcgis.com/en/arcgis-online/manage-data/calculate-fields.htm ).  You can then do a sum of the new field in an Indicator element. 

-Vivek.

0 Kudos
MatthewBradbury
New Contributor III

Hi @VivekMalleshappa,

This is the work around I had to do initially, though it's a static calculation that has to be repeatedly performed to keep up with new records. At the moment, I am exporting all of the feature data every hour with FME and processing it with a Python script and then truncating and appending the summary table records in AGOL. Hopefully this functionality is added in the future, since this process is quite cumbersome.

0 Kudos