HOW TO

Calculate the mean and use the GroupBy() function to summarize a table in ArcGIS Dashboards

Last Published: June 8, 2022

Summary

In ArcGIS Dashboards, Arcade expressions can be used to customize how data points render for list, indicator, and table elements. Depending on the element configured, a data point can represent a feature or a summary statistic.

This article provides the steps to calculate the mean of an array of numbers and group the result into one column. The image below displays the summarized table of the average number of major events occurring in Germany.

The ArcGIS Dashboard with the general table on the top left

Procedure

  1. Open the ArcGIS Dashboards item. Click Add element on the dashboard toolbar and place the element in the dashboard.
The Dashboard toolbar with the Add element button
  1. Select Table element, and click New data expression.
The Select a layer window with the New data expression button.
  1. Specify the following Arcade expression in the Expression window.
var fs = FeatureSetByPortalItem(Portal('<portal URL>'), '<itemId>', <sublayerId>, ['<field_name_1>', '<field_name_2>', ..., '<field_name_n>'], false);

var group_exp = [
{ name: '<field_name_new>', expression: '(<integer_field_1> + <integer_field_2> + ... + <integer_field_n>) / <integer field count>', statistic: 'SUM'}]

return GroupBy(fs,['<field_name_1>', '<field_name_2>'], <variable_name2>)

return fs
Note:
Specifying the fields and including Geometry parameters in the FeatureSet are optional expressions for the FeatureSetByPortalItem() function. Refer to ArcGIS Arcade: FeatureSetByPortalItem for more information.
The Arcade expression specified in the Expression window
  1. Click Test and review the results below the Expression window.
  2. Specify a name for the expression and click Done.
The Arcade expression's test results
  1. Generate and format the table as desired. Refer to ArcGIS Dashboards: Table for more information. Click Done.

Article ID: 000027670

Software:
  • ArcGIS Online
  • ArcGIS Dashboards

Receive notifications and find solutions for new or common issues

Get summarized answers and video solutions from our new AI chatbot.

Download the Esri Support App

Related Information

Discover more on this topic

Get help from ArcGIS experts

Contact technical support

Download the Esri Support App

Go to download options