Aggregate Data within a Form

Edit in →

Dynamic Matrix supports different data aggregation methods that you can use to combine or summarize data across multiple matrix rows or columns based on provided answers. For instance, in a Dynamic Matrix where users input numerical values, aggregation might involve calculating totals, averages, counts, or other statistical operations across rows or columns. This example illustrates the dynamic generation of Totals for rows and columns based on selected phone models and their quantities.

Calculate Row Totals

A row total aggregates values in a particular matrix row. To calculate and display row totals, create a column with the cellType property set to "expression". Create an expression to calculate row totals. Within the expression, you can access individual row cells using the row prefix as follows: {row.columnName}. For a code example, refer to the "Total" column configuration in the survey.json file.

Calculate Column Totals

A column total aggregates values in an individual matrix column. Use the following column properties to configure column totals:

  • totalType: "sum" | "count" | "min" | "max" | "avg"
    An aggregation method.

  • totalDisplayStyle: "decimal" | "currency" | "percent"
    A format for calculated total values.

  • totalFormat: string
    A string pattern used to display column totals. To reference a total value within this pattern, use the {0} placeholder.

This demo calculates column totals for the "Phone model", "Quantity", and "Total" columns. You can find their configurations in the survey.json file.

To access the total value of an individual column, use the total suffix as follows: {matrixName-columnName.total}. In the current demo, this suffix is used by the "VAT" and "Total" questions. Refer to the survey.json file for a code example.

Your cookie settings

We use cookies on our site to make your browsing experience more convenient and personal. In some cases, they are essential to making the site work properly. By clicking "Accept All", you consent to the use of all cookies in accordance with our Terms of Use & Privacy Statement. However, you may visit "Cookie settings" to provide a controlled consent.

Your renewal subscription expires soon.

Since the license is perpetual, you will still have permanent access to the product versions released within the first 12 month of the original purchase date.

If you wish to continue receiving technical support from our Help Desk specialists and maintain access to the latest product updates, make sure to renew your subscription by clicking the "Renew" button below.

Your renewal subscription has expired.

Since the license is perpetual, you will still have permanent access to the product versions released within the first 12 month of the original purchase date.

If you wish to continue receiving technical support from our Help Desk specialists and maintain access to the latest product updates, make sure to renew your subscription by clicking the "Renew" button below.