The calculator allows you to create relationships between rows and quantify new totals using event counts, user counts, or numerical values. The calculator can be accessed by choosing the icon located in the menu bar beneath the query builder.

The Calculator is a set of arithmetic calculations where you may add, subtract, multiply, or divide any two query rows. Only two rows may be used in a single calculation. The calculator interface displays a list of your query rows on the left and a calculator field, including a list of mathematical operations, on the right. The list of query rows will display the row name, which can be edited or renamed within the query builder.

Calculate Using Rows

To create a calculation using two rows, simply select the row name you’d like to use, then drag and drop the row name into the first (top) or second (bottom) drop zone. You may switch drop zones by selecting the up and down arrows to the left of the calculator field. Remove a row from the calculator by selecting the red “X” icon before the row name.

The calculator supports the four basic mathematical operations- addition, subtraction, multiplication, and division- and can also automatically calculate a percentage. Percentage and Division are based on the same calculation, with the difference being that Percentage does an additional calculation of multiplying the resulting value by 100. To change the operation for your calculation, simply select the relevant icon.

Once you’ve completed each field and selected an operation, choose Calculate to create a new query row containing your calculation. Selecting a calculation row will re-open the tool for editing. Calculations are visualized in the chart area alongside the underlying queries. 

Calculate Using Numbers

To add a number to your calculation, simply select the first (top) or second (bottom) drop zone and enter the value. Numerical values can be used independently or in combination with a query row. 

Complex Calculations

Only two rows may be used in a single calculation. If you’d like to create a calculation with more than two rows, you’ll need to use a calculation query row as a component of another calculation. For example, to calculate the sum of A+B+C, you may calculate A+B and then use this new row to calculate (A+B)+C. Changes in underlying query rows are calculated before calculation query rows, so your calculation will update automatically if its underlying data changes.

You may hide the component queries by hovering the cursor over the row you’d like to hide, then selecting Deactivate Row. This will not delete the row, but the hidden row will not appear in your results. Deactivated rows are grayed out in the query builder.

How It’s Done

Calculations are performed with the results of the two composing query rows. For example, imagine you had the following rows: 

  • Users who performed AddtoCart.
  • Users who performed RemovefromCart.

If we perform a calculation to subtract the second row from the first row, Analytics will first find the results of the two composing rows and then perform the subtraction between them. Please note, this does not mean that the subtraction results in a list of users who added to cart and then removed from cart. To perform such an analysis, see the article on Did [not] Perform Clauses.

Similarly, if we perform a calculation to add the second row from the first row, Analytics will first find the results of the two composing rows and then perform the addition between them. There will be NO deduping when calculating the sum. Users can be inclusive in both the first row and second row criteria and the sum calculation will only look to add the values of the two results (potentially counting the user twice).

Was this page helpful?