The Calculated Metrics Builder lets you apply statistical and mathematical functions to build Advanced Calculated Metrics.
Here is an alphabetical list of the functions and their definitions.
Where metric is identified as an argument in a function, other expressions of metrics are also allowed. For example, MAXV(metrics) also allows for MAXV(PageViews + Visits).
A table function is one where the output is the same for every row of the table. A row function is one where the output is different for every row of the table.
Returns the absolute value of a number. The absolute value of a number is the number with a positive value.
ABS(metric)
Argument | Description |
---|---|
metric | The metric for which you want the absolute value. |
Returns the largest value in a set of dimension elements for a metric column. MAXV evaluates vertically within a single column (metric) across dimension elements.
MAXV(metric)
Argument | Description |
---|---|
metric | A metric that you would like to have evaluated. |
Returns the smallest value in a set of dimension elements for a metric column. MINV evaluates vertically within a single column (metric) across dimension elements.
MINV(metric)
Argument | Description |
---|---|
metric | A metric that you would like to have evaluated. |
Adds all of the numeric values for a metric within a column (across the elements of a dimension).
SUM(metric)
Argument | Description |
---|---|
metric | The metric for which you want the total value or sum. |
Returns the number, or count, of non-zero values for a metric within a column (the number of unique elements reported within a dimension).
COUNT(metric)
Argument | Description |
---|---|
metric | The metric that you want to count. |
Returns e raised to the power of a given number. The constant e equals 2.71828182845904, the base of the natural logarithm. EXP is the inverse of LN, the natural logarithm of a number.
EXP(metric)
Argument | Description |
---|---|
metric | The exponent applied to the base e. |
Power Operator
pow(x,y) = x^{y} = x*x*x*… (y times)
Returns the arithmetic mean, or average, for a metric in a column.
MEAN(metric)
Argument | Description |
---|---|
metric | The metric for which you want the average. |
Returns the median for a metric in a column. The median is the number in the middle of a set of numbers—that is, half the numbers have values that are greater than or equal to the median, and half are less than or equal to the median.
MEDIAN(metric)
Argument | Description |
---|---|
metric | The metric for which you want the median. |
The remainder of col1 / col2, using Euclidean division.
Returns the remainder after dividing x by y.
x = floor(x/y) + modulo(x,y)
The return value has the same sign as the input (or is zero).
modulo(4,3) = 1
modulo(-4,3) = -1
modulo(-3,3) = 0
To always get a positive number, use
modulo(modulo(x,y)+y,y)
Returns the k-th percentile of values for a metric. You can use this function to establish a threshold of acceptance. For example, you can decide to examine dimension elements who score above the 90 percentile.
PERCENTILE(metric,k)
Argument | Description |
---|---|
metric | The metric column that defines relative standing. |
k |
The percentile value in the range 0 to 100, inclusive. |
Returns the quartile of values for a metric. For example, quartiles can be used to find the top 25% of products driving the most revenue. MINV, MEDIAN, and MAXV return the same value as QUARTILE when quart is equal to 0 (zero), 2, and 4, respectively.
QUARTILE(metric,quart)
Argument | Description |
---|---|
metric | The metric for which you want the quartile value. |
quart |
Indicates which *value to return. |
*If quart = 0, QUARTILE returns the minimum value. If quart = 1, QUARTILE returns the first quartile (25 percentile). If quart = 2, QUARTILE returns the first quartile (50 percentile). If quart = 3, QUARTILE returns the first quartile (75 percentile). If quart = 4, QUARTILE returns the maximum value.
Returns the nearest integer for a given value. For example, if you want to avoid reporting currency decimals for revenue and a product has $569.34, use the formula Round( Revenue) to round revenue to the nearest dollar, or $569. A product reporting $569.51 will be round to the nearest dollar, or $570.
ROUND(metric)
Argument | Description |
---|---|
number | The metric you want to round. |
Round without a digits parameter is the same as round with a digits parameter of 0, namely round to the nearest integer. With a digits parameter it returns that many digits to the right of the decimal. If digits is negative, it returns 0’s to the left of the decimal.
round( 314.15, 0) = 314
round( 314.15, 1) = 314.1
round( 314.15, -1) = 310
round( 314.15, -2) = 300
Returns the count of rows for a given column (the number of unique elements reported within a dimension). “Uniques exceeded” is counted as 1.
The maximum of the columns in each row.
The minimum of the columns in each row.
The sum of the columns of each row.
Returns the positive square root of a number. The square root of a number is the value of that number raised to the power of 1/2.
SQRT(metric)
Argument | Description |
---|---|
number | The metric for which you want the square root. |
Returns the standard deviation, or square root of the variance, based on a sample population of data.
The equation for STDEV is:
where x is the sample mean (metric) and n is the sample size.
STDEV(metric)
Argument | Description |
metric | The metric for which you want for standard deviation. |
Returns the variance based on a sample population of data.
The equation for VARIANCE is:
where x is the sample mean, MEAN(metric), and n is the sample size.
VARIANCE(metric)
Argument | Description |
---|---|
metric | The metric for which you want the variance. |
In order to calculate a variance you look at an entire column of numbers. From that list of numbers you first calculate the average. Once you have the average you go through each entry and do the following:
Subtract the average from the number.
Square the result.
Add that to the total.
Once you have iterated over the entire column you have a single total. You then divide that total by the number of items in the column. That number is the variance for the column. It is a single number. It is, however, displayed as a column of numbers.
As an example, let’s say you have a three-item column:
1
2
3
The average of this column is 2. The variance for the column will be ((1 - 2)² + (2 - 2)² + (3 - 2)²/3 = 2/3. In Ad Hoc Analysis this will look like this:
1 2/3
2 2/3
3 2/3