Survey calculations

Learn how to use the calculations to automatize some data points in your survey
Written by Impact Atlas
Updated 1 year ago

Calculation is one of the element types available in the form builder when creating or editing a survey. As the name suggests, calculations are used automatize updates or visibility of certain data points. For example, if you want to know the total income of the family based on different sources. Or, if you want to have visibility of the participant actual age based on the date of birth and so on.

The current calculation options are:

  • Arithmetic calculation: addition (+), subtraction (-), division (/) or multiplication (*): you can use this one to combine elements from multiple questions;

  • Age: calculate someone’s age from date of birth to current date;

  • Age at date: calculate someone’s age from the date of birth to a certain date (for example start of program);

  • Intent: bring an information available in another survey within the same cohort;

  • Automatic participant deactivation: this functionality is specially used for selection surveys and whenever the participant does not attend the required criteria, you can add rules for automatic deactivation;

  • Write your own: you have the possibility to create your own calculation as well;

How to use the calculations

To access it, you need to go to the "Form Builder" in the left menu:

Then, you can create a new survey or edit an existing one that is either in draft or test. Once you are in the survey, you can see the "Calculation" in right as part of the Elements table:

Arithmetic calculation

To add a calculation, you just click on "Calculation" element on the right and place it wherever you prefer. You can also drag and drop to the survey itself. Then, you click on the "edit" icon:

In this example, we are going to use an arithmetic calculation to sum all the income of a participant. Please note that the questions should be number type to enable the arithmetic calculation. Once you finish editing, you can save it:

Age or Age at date

It is very straight forward to use age or age at date calculation, you just need to have a date of birthday question in date format and refer this question in the calculation as the example below:

Intent

To use the intent, you just need to select the survey and the question you want to;

Automatic participant deactivation

This type of calculation is usually used for selection survey where there are cases that the participant does not meet the criteria to join the program. To use it, you need to refer to the question (s) that will be the trigger to deactivate the participant:

Write your own

You also have the option to write your own calculation. Follow some examples below:

The question numbers will always be written in {curly brackets}

IF Calculation with static value

One condition:

This is very similar to the “if-else” logic.

if({9060}>2, yes, no)

If Question ID 9060 has a value above 2 return yes

Multiple conditions can also be added

if({4476} = 4, 1, 0) || if({9028} = 2 && {9032} > 17 && {9032} < 65, 1, 0)

If question 4476 equals 4 then return 1, else return 0 or if question 9028 equals 2 and question 9032 has a value higher than 17 and question 9032 has a value under 65 return 1 else return 0

Multiple IF Calculation with "if-else" static value and Arithmetic

You can return computed values based on the questions value

if({9597} <= 28, 15, 0) + if({9597} > 28 && {9597} <= 68, 10, 0)

If question 9597 is equal or lower than 28 return 15 else return 0

If question 9597 is above 28 and question 9597 is equal or lower than 68 return 10 else return 0

So if we had 9597 with a value of 10 the calculation would return 15 + 0 = 15

So if we had 9597 with a value of 30 the calculation would return 0 + 10 = 10

Did this answer your question?