Skip to Content
HelpSurveysCalculations

Survey Calculations

Calculations take the results of questions and lookups from your survey template and let you derive new values using arithmetic. Calculations can also reference other calculations. You can add, subtract, multiply, and divide to produce values used in recommendations.

To create a calculation, click the Calculations tab on the survey template and then + Add Calculation.

On this screen: The Calculations tab of the survey template editor displays a table with four columns: Name, Slug, Calculation, and an actions column. Each row represents an existing calculation and is clickable to edit it. A delete button appears in the actions column for each row. At the bottom of the table, a footer row contains the + Add Calculation button.

If you need to insert a fixed value into a recommendation, you can create a calculation that adds 0 + 1 to return that constant.

Basic Calculations

To create a calculation based on question responses, reference questions by their slug and combine them with the available operators. The right side of the calculation form lists all available operands and operators.

On this screen: The Calculation form is split into two columns. The left column (two-thirds width) contains two fields: Name of the result (a text input with placeholder “Sum of parts”) and Calculation to be performed (a text input with placeholder “floors * area_per_floor”). A Submit button and a Back link appear below. The right column (one-third width) shows reference sections: Operators for Calculation lists Add (+), Subtract (-), Multiply (*), Divide (/), Grouping ( ), and the conditional syntax Condition ? Value-If-True : Value-If-False; Operators for Testing Values lists Greater Than (>), Greater Than or Equal To (>=), Equal To (==), Not Equal To (!=), Less Than or Equal To (<=), and Less Than (<); and Operands for Calculation lists the slugs of available Questions (number type), Lookups, and other Calculations from the survey template.

For example, a calculation can multiply the response to one question by the response to another:

On this screen: The Calculation to be performed field contains an expression that multiplies the slugs of two questions together, such as question_one * question_two. The operands listed in the right panel show the slugs of both questions under the Questions subsection.

The resulting value can then be used as the quantity for a service recommendation.

On this screen: The Recommendation form shows a Quantity dropdown (labeled “Survey value or calculation”) that lists all available question slugs, lookup slugs, and calculation slugs as selectable options. An Item Type dropdown (Service, Governance, or Product) and an Item grouped dropdown for choosing the specific service appear alongside it. Below, a section labeled When does the recommendation apply? offers radio buttons for “Always” or “Only when” with conditional fields for selecting a survey value, a comparison operator (Greater Than, Equal To, etc.), and a comparison value.

Conditional Statements

Conditional statements let you return different values based on a test. The syntax is:

condition ? value-if-true : value-if-false

For example, qty > 2 ? 100 : 50 checks whether the response to the question with slug qty is greater than 2. If it is, the calculation returns 100. If not, it returns 50.

On this screen: The Calculation to be performed field contains a conditional expression such as qty > 2 ? 100 : 50. The right panel shows the conditional syntax reference: Condition ? Value-If-True : Value-If-False, and the Operators for Testing Values section which lists the available comparison operators. The slug qty appears in the Questions operands list on the right.

When the survey is completed, the calculated results display the computed values:

On this screen: The survey results page shows a Calculated Results section. Each row displays the calculation’s name as a definition term and its computed numeric value as the definition description. In this example, the calculation result shows 100 because the quantity entered was greater than 2.

Last updated on