How To: Calculate the sum of repeats in ArcGIS Survey123
Calculating the sum of repeats enables users to summarize the total value across multiple repeat questions answered in the same primary record. For example, to record the total items inspected during an asset inspection, to determine the total volume of chemical waste disposed by a chemical facility, or to identify the total tonnage of recyclable material collected from a residential area.
In this example, the repeat section comprises the details of items collected from a few warehouses. The details of one item type is filled in one repeat record. The sum() function is used to calculate the total number of items and the total number of boxes collected from multiple repeat records based on the item types collected.
The sum of repeats is calculated using the sum() function outside the repeat section. Follow the steps below to calculate the sum of repeats in ArcGIS Survey123:
- Open ArcGIS Survey123 Connect and create a survey using an Advanced template.
- Click the Open XLSForm spreadsheet icon to open the Excel form.
- Configure the form to contain a repeat section.
- Outside the repeat section, create an integer or decimal type question. In the calculation column, use the sum() function to calculate the sum of repeats.
The image below shows the sum() function configured in the calculation column outside the repeat section. The sum() function is used to calculate the total number of items and the total number of boxes collected based on the details provided in the repeat records.
Note: Other aggregate functions such as count(), max(), and min() can also be calculated from the repeat records. These functions work with repeats within the same primary record, and not across repeat records in the survey.
- Save the Excel form and publish the survey.
The image below shows the sum of all repeats calculated automatically in the survey form.
When viewing the hosted feature layer in Map Viewer, the attribute table shows the sum of repeats and other aggregate functions configured in the survey form. The image below shows the sum of items and boxes collected in a single survey response with three repeat records.
The individual records of each repeat record are stored in the related record table. The image below shows the details of the three repeat records sent in the single survey response. The Total items collected column in the attribute table is calculated based on the sum of the Number of items collected column in this related record table.
- ArcGIS Survey123: Formulas
- GeoNet: World Milk Day Release (2.1)
- GeoNet: Calculating a final total from repeats, Survey123?
- GeoNet: count() and sum() functions for repeat in Inbox
- GeoNet: Survey123 built-in functions
Last Published: 11/16/2020
Article ID: 000021664
Software: ArcGIS Online 8.2 ArcGIS Survey123 3.9, 3.8, 3.7, 3.6, 3.5, 3.4, 3.3, 3.2, 3.11, 3.10, 3.1, 3.0, 2.9.Classic, 2.8