PROBLEM

Unable to sort field values populated using advanced formatting in ArcGIS Dashboards

Last Published: February 5, 2026

Description

In ArcGIS Dashboards, numeric values that are populated through advanced formatting expressions cannot be sorted in ascending or descending order when the Table elements 'Sort by' option is used.

The Table elements below show the order of the populated field values remains unchanged when 'Sort ascending' or 'Sort descending' is selected.

Unable to sort field in ascending order
Unable to sort field in descending order

Cause

Table sorting in Dashboards is applied to the underlying FeatureSet before any advanced formatting is evaluated, whereas Arcade expressions only control the 'displayText' property displayed in each table cell during rendering. They do not create, modify, or retain field values in the FeatureSet. Because these calculated values only exist in the visualization layer and are not part of the data used for sorting, the table order remains unchanged when sorting is applied. Sorting is only supported for fields that exist as actual attributes in the FeatureSet before rendering.

Solution or Workaround

Generate a new FeatureSet with populated field values using data expression in Dashboards

  1. In Dashboards, open the dashboard edit page.
  2. Click Add element on the dashboard's toolbar, place an element on the layout and select Table to create a table element.
Add a table element
  1. In the Select a layer window, under Data expressions, click New data expression.
  2. In the Edit data expression window, specify the expression to populate values in the field and click Done.
Note: The expression below is used to populate the field by combining the values from two other fields. Modify the operations accordingly.
var portal = Portal("portal_URL"); // Replace with URL of the portal

// Get the source FeatureSet
var fs = FeatureSetByPortalItem( portal, "ITEM_ID", // Portal item ID of the layer or table 0, // Layer index [ "CategoryField", "LabelField", "NumericField1", "NumericField2" ], false ); // Build a new FeatureSet with calculated values var features = []; for (var f in fs) { var value1 = DefaultValue(f.NumericField1, 0); var value2 = DefaultValue(f.NumericField2, 0); Push(features, { attributes: { CategoryField: f.CategoryField, LabelField: f.LabelField, NumericField1: value1, NumericField2: value2, CalculatedField: value1 + value2 } }); } // Return the FeatureSet used by the table return FeatureSet({ fields: [ { name: "CategoryField", type: "esriFieldTypeString" }, { name: "LabelField", type: "esriFieldTypeString" }, { name: "NumericField1", type: "esriFieldTypeInteger" }, { name: "NumericField2", type: "esriFieldTypeInteger" }, { name: "CalculatedField", type: "esriFieldTypeInteger" } ], geometryType: "", features: features });

Below is the working script for this example. The NewField field is populated by adding the values in the SalesVolume and EmployeeCount fields.

var portal = Portal("portal_URL"); // Replace with URL of the portal

var fs = FeatureSetByPortalItem(
    portal,
    "ITEM_ID",   // Replace with layer/table ID
    0,
    [
        "Status",
        "City",
        "SalesVolume",
        "EmployeeCount"
    ],
    false
);

var features = [];

for (var f in fs) {

    var sales = DefaultValue(f.SalesVolume, 0);
    var employees = DefaultValue(f.EmployeeCount, 0);

    Push(features, {
        attributes: {
            Status: f.Status,
            City: f.City,
            SalesVolume: sales,
            EmployeeCount: employees,
            NewField: sales + employees
        }
    });
}


return FeatureSet({
    fields: [
        { name: "Status", type: "esriFieldTypeString" },
        { name: "City", type: "esriFieldTypeString" },
        { name: "SalesVolume", type: "esriFieldTypeInteger" },
        { name: "EmployeeCount", type: "esriFieldTypeInteger" },
        { name: "NewField", type: "esriFieldTypeInteger" }
    ],
    geometryType: "",
    features: features
});
Output for data expression
  1. Add and sort the populated field.
    1. In the Table window, on the Data tab, in the Data options pane, select Features for Table type.
    2. For Value fields, click the Add field drop-down list to select and add the fields to the table.
    3. For Sort by, click the Add field drop-down list and add the populated field. Select Sort ascending or Sort descending to sort the field in the preferred order.
    4. Click Done.
Note:
Delete the old table element from the options menu, if necessary. Refer to ArcGIS Dashboards: Add elements for more information.

Populate the field values using the Calculate Field tool in ArcGIS Pro

  1. In ArcGIS Pro, open the project containing the feature class.
  2. Use the Calculate Field tool to create an Arcade expression to populate values in the field.
    1. Open the attribute table of the feature class, right-click the header of the field and click Calculate Field.
Calculate Field tool
  1. In the Calculate Field window, for Expression Type, select Arcade.
  2. For Expression, specify the code in the expression box. In this example, the following expression is used to populate the field values by adding the values in the SalesVolume and EmployeeCount fields.
$feature.SalesVolume + $feature.EmployeeCount
Arcade expression used in Calculate Field tool
  1. Click Apply > OK. The field is populated with values.
Calculate Field tool output
  1. Share the map as a web map to ArcGIS Online. Refer to ArcGIS Pro: Share a web map using a chosen configuration for more information.
  2. In ArcGIS Online, create a new dashboard and add a table element to the dashboard. Refer to ArcGIS Dashboards: Create a dashboard for more information.
  3. Configure the Table element and sort the field.
    1. In the Select a layer window, select the layer.
    2. In the Table window, on the Data tab, in the Data options pane, select Features for Table type.
    3. For Value fields, click the Add field drop-down list to select and add the fields to the table.
    4. For Sort by, click the Add field drop-down list and add the populated field. Select Sort ascending or Sort descending to sort the field in the preferred order.
    5. Click Done.

The Table elements below show the field sorted in the intended order when 'Sort ascending' or 'Sort descending' is selected.

The field can be sorted in ascending order
The field can be sorted in descending order

Article ID: 000038714

Software:
  • ArcGIS Pro
  • ArcGIS Online
  • ArcGIS Dashboards

Get support with AI

Resolve your issue quickly with the Esri Support AI Chatbot.

Start chatting now

Related Information

Discover more on this topic

Get help from ArcGIS experts

Contact technical support

Start chatting now

Go to download options