Learn how to use the Calculate Tool to add equations to your tables including totals, proportions and variances.
How do I create a Calculation?
- Click Calculate and the calculator will open on the left side bar.
- Enter a formula for the calculation, noting:
- You can do this using your mouse by clicking on the calculator buttons, or focus the formula input field and type your formula using a keyboard.
- You can add references to rows from your insight table by clicking on the row number that will appear to the left of the table row.
- These can also be entered manually but must be in the format Row# ; for example Row12 .
- Hit the = button to perform the calculation and add it to the table.
How do I edit a Calculation?
- Click on the dropdown arrow next to the calculation row.
- Click Edit Calculation to open the calculator on the left side bar.
- The calculation formula will be pre-populated in the input box. Update the formula as needed and then click = to finish updating the calculation.
How do I rename a Calculation?
- Click on the dropdown arrow next to the calculation row.
- Click Rename.
- The calculation name will become editable, update it to suit and click away from the input field to finish renaming.
How do I delete a Calculation?
- Click on the dropdown arrow next to the calculation row.
- Click Delete.
Formatting a Calculation
Calculations can be formatted as either a decimal or a percentage. Click on the 0.0 button to format as a decimal number (the default behaviour). Click on the % button to format as a percentage.
Validation
While working on a calculation you will see a green check mark to the right of the calculation formula if the formatting is valid. If the formula is invalid a red cross mark will display and the formula has to be corrected before the = button can be clicked to finalise the calculation.
Supported math operations
The following is a list of currently supported math symbols and operators available to the calculate tool.
- Standard arithmetic operators for addition, subtraction, division and multiplication.
-
i.e. 1+2-3/4*5
-
- The power operator.
-
i.e. 5^2
-
- Opening and closing Parentheses.
-
i.e. (1+5)/2
-
Advanced Calculator Concepts
Under the hood, calculations use a popular open source library Math.js to evaluate formulas. Beyond the supported operations listed above, there is much more functionality that can be taken advantage of (with some caveats which will be discussed).
Links to some useful Math.js functions you can make use of in the calculator:
- https://mathjs.org/docs/reference/functions.html#arithmetic-functions
- https://mathjs.org/docs/reference/functions.html#statistics-functions
- https://mathjs.org/docs/reference/functions.html#probability-functions
- https://mathjs.org/docs/reference/functions.html#trigonometry-functions
How to use the functions:
To use the functions they must be used in the expression syntax, so for example if you wanted to get the maximum number from a set of numbers you would use the math.max function as follows:
-
max(1,3,2)+7
- which yields 10, since 3 is the largest of the set [1,3,2] and adding 7 to it gives us 10
Read more about Math.js expression syntax here https://mathjs.org/docs/expressions/syntax.html
Caveats
- Only functions that return a single number can be used.
- Functions that return anything else (Matrices, Strings, Booleans etc) will not work correctly and are unsupported.