You can use simple numeric functions to perform basic mathematical calculations. For more advanced calculations, see Creating advanced mathematical calculations.
Available numeric functions
This section lists all available simple numeric functions. In the Functions window, you can view only numeric functions by clicking the Filter button, then selecting the Numeric category.
|ABS(Number)||Returns the absolute value of the given parameter (ignores any number sign).|
|BETWEEN(Number, Number, Number)||Returns true if the first number is inside the range of the second and third numbers.|
|CEIL(Number)||Returns the closest integer greater than or equal to the number entered in the parameter.|
|EXP(Number)||Returns the value of the base of the natural logarithm (e), to the power of the exponent entered in the parameter.|
|FLOOR(Number)||Returns the closest integer less than or equal to the number entered in the parameter.|
|GROWTH_RATE(Number, Number)||Calculates change from the first entered number (x) to the second entered number(y), such as (y-x)/x.|
|INTEGER(param)||Returns the integer representation of the given parameter.|
|IS_NAN(value)||Returns true if the entered value is NaN(not a number).|
|MAXIMUM(Number, Number)||Evaluates two parameters and returns the largest value. Remember you can find the maximum value within a given metric by choosing the MAX data aggregator.|
|MINIMUM(Number, Number)||Evaluates two parameters and returns the smallest value. Remember, you can find the minimum value within a given metric by choosing the MIN data aggregator.|
|NUMBER(param)||Returns the number representation of the given parameter, or returns NaN when it cannot be displayed as a number. When the given parameter is a date, it returns the number of milliseconds between 0:00:00 GMT January 1, 1970 and the given date.|
|PI||Returns the mathematical constant for the ratio of the circumference of a circle to its diameter, expressed as PI. The value is 3.141592653589793.|
|POWER(Number, Number)||Computes and returns the first entered number to the power of the second entered number.|
|RANDOM||Returns a pseudo-random number 'n' where 0<=n<1. If you need a random integer, use the formula Round(Random()*100).|
|ROUND(Number)||Rounds the value of the number entered in the parameter up or down to the nearest integer. If equidistant, the value is rounded up.|
|SIGN(Number)||Returns -1 if the number is negative, 0 if zero, and 1 if positive.|
|SQRT(Number)||Returns the square root of the entered number.|
|SQUARE(Number)||Returns the square of the entered number.|
|LN(number)||Returns the natural logarithm of the entered expression or number|
|LOG10(Number)||Returns the Base-10 logarithm of the entered number or expression|
|LOG2(Number)||Returns the Base-2 logarithm of the entered number or expression.|
|LOG(Base, Number)||Returns the logarithm of entered number to entered base.|
Writing formulas with mathematical operators
In addition to simple numeric functions, you can use basic mathematical operators to perform calculations and connect text.
The following operators are available in Explore:
- +: Addition, or used to concatenate text values (see Using text functions).
- -: Subtraction
- *: Multiplication
- /: Division
- %: Modulo/remainder
To calculate total revenue
- In the calculations menu (), select Standard calculated metric.
- Name your calculated metric.
- Select your Replies metric from the Select a field drop-down list or type in the metric name.
Note: If you type in your metric, you must either select Explore's auto-complete suggestion or replicate the metric in the same formatting. Calculations will not process incorrect formatting.
- Type in a / symbol for division.
- Select your quantity metric from the Select a field drop-down list or type in the metric name.
- Click Save.
- Click the Add from the metrics panel to add the calculated metric to your query.