March 16, 2020 The BMS lab

Calculated variables

Quick guide

Calculated variables are made up of the answer on an item and then used to direct a participant to a specific module. Therefore you have to start with making the items for the calculated variable.

Create Calculated Variables

Step 1.

On the left menu click on modules. Open your module and go to content items. Calculated Variables will only work with certain inputs including the numerical (Number input, number slider, number dropdown, and number choice), and some character-based options (dropdown, yes-no, multiple choice, likert scale).

In the chosen item preview menu, click on ‘Used for numeric Calculation’ and click on save.

Step 2.

In the left menu go to the calculated variables tab. On the page click on the “Add a calculated variable” button. Here you can give you variable a unique name, a short description and you can input your equation. You can create an equation using the functions and BODMAS.

Functions explained


  • + will give the addition of variables.
  • – will give the subtraction of variables.
  • * will give the multiplication of variables.
  • / will give the division of variables.
  • ^ will give the exponential value of a number.
  • SUM_ANS(variable1) will give the different responses of all participants of the variable and sum them.
  • NUM_PS(variable1) will give the total number of participants for an indicated variable. Example: three participants are assigned to an intervention, this function will return 3.
  • NUM_P_ANS(variable1) ill give the number of participants who answered the indicated variable. Example: three participants are assigned to an intervention, two gave an answer. This function will return 2.
  • MODE_ANS(variable1) will give the most responded number of the indicated variable. If there is no mode this function will return the average.

Using calculated variables as feedback

Step 1.

To be able to show the calculated variable you should first make a new module. Then go to content items and create a new item, the item type does not matter for this.
Click on dynamic text, a pop-up screen will appear.

Step 2.

Click on ‘select a calculated variable’, a dropdown list will appear. Select your calculated variable and click on ‘ok’. A code will now appear in the preview screen. This code will show a number once the items used for the calculated variable are filled in the by the participant.

Calculated variables for time rule intervention

Step 1.

You can use your calculated variable as a time-rule intervention. In the left menu go to interventions. Open an intervention and click on modules. You can now use the calculated variable as a time rule intervention.

For more information on time rule interventions, see time rule interventions.