Numerical Calculations
Want to calculate the numerical value for a field based on prior variables? Use invisible logic. Or, you can do so by entering your mathematical equation in the format below. Remember to set your variables as Number questions in your interview.
Use any combination of + - * and / to create calculations in your documents.
Addition
This field will display the value of variable1 plus variable2:
{{ (variable1 + variable2)|float }}
Multiplication/Division
This field will display the value of 100 times variable1 divided by variable2 (useful for a percentage):
{{ (100 * variable1/variable2)|float }}
Round Down
This will round the number down (floor) and leave 2 decimal points:
{{(variable)|round(2, 'floor') }}
Round Up
This will round the number up (ceiling) and leave 2 decimal points:
{{(variable)|round(2, 'ceil') }}
To The Power Of
This will take variable1 to the power of variable2 (either could be replaced with an actual number):
{{ (variable1**variable2)|float }}
Advanced Options
If you're using the rounding options above and you also have other formatting on your numbers, make sure to put the rounding options inside of the parentheses.
Ex. {{ “{:,.0f}”.format(variablename|round(0,’ceil’)) }}