Apply

How to Calculate the Average (AVG)

Using Advanced Expression Piping within your forms you can create mathematical formulas in order to calculate a value. A common formula used is to determine the Average value from multiple fields. This article will demonstrate how to configure an AVG expression using AEP within a form.

The AVG function allows the expression to calculate the average value within a given list. While not as commonly used as the SUM function, this function provides a quick way of getting the average from a list of different variables within a form or from a column within a table.

The setup and formatting of the AVG expression is imperative in preventing an error message from appearing on your form where the result of your expression would normally appear. The first line of the AVG expression should be set up as follows:

• Each expression is always contained within a pair of double "curly" brackets {{  }}
• There should be a space between the first instance of AVG and the last bracket
• Variables you are using are case sensitive
• Always close the AVG operation with brackets ( )

This setup for the Average will work using the single operator (,) for a list of fields you wish to find the average for together. An example of using this setup would be when you are looking to find the average of a list of items within a table or to find the average of the a list of total scores.

While you can use the Average function to find averages throughout a form task, it would not be possible to pull an average of a list of averages within the the same expression.

For example: {{ AVG(AVG(q1[:0]),AVG(q2[:0])) }} is not a valid expression.