MATH formulas in crosstabs
When working with crosstabs, you have the option to use mathematical formulas similar to those in Excel. However, instead of addressing a cell, here you select row or column labels (header labels).
How to enable Math on crosstab
Go to Project settings → Settings → Math;
Tick the box provided to enable the display of the MATH window in the Crosstab
After enabling the math feature, the "MATH" button is displayed above the table in the crosstab interface.
Here you can also determine what will be taken as the base for mathematical expressions in the case of different bases:
AVG - as an average of bases;
SUM - as a sum of bases;
MIN - as a minimum base;
MAX - as a maximum base.
How to use MATH in a crosstab
The DVI interface has a special window for entering formulas. Here we've added a prompting option for ease of use.
Click the MATH button to open the MATH window
First, select whether the calculation results will be displayed in a row or column. Depending on this, you can operate with variables in rows or columns respectively for some calculations;
Press Ctrl+Space/Cmd+Space to activate prompts;
Enter an expression you need in the MATH window, using formulas and arithmetic operations;
Click the 'Add' button and get the result in a row/column.
In the prompts, presented header labels of rows/columns are marked with the 'x' symbol; the functions are marked with the 'f' symbol.
Syntax & Formulas Usage
A range of functions represent metrics that previously had to be deliberately added to a crosstab. Now you can get the value of a metric by a function, then apply a mathematical operation to it.
These metric functions are:
Syntax | Result |
---|---|
| returns the mean value based on the digit value of the selected variable |
| returns the base value of the selected variable; returns the statistical base value; returns the unweighted base value of the selected variable; returns the common unweighted base value |
| returns the count of the selected variable |
| returns the horizontal percent of the selected variable |
| returns the value of the unfiltered Affinity index returns the value of the filtered Affinity index |
| returns the vertical percent of the selected variable |
| returns the volume value of the selected variable |
Other functions give you the following values:
Syntax | Result |
---|---|
| returns the absolute value of the chosen variable or the expression |
| returns the average value of the chosen variable or the expression |
| returns the average value of the chosen variable or the expression including SYSMIS |
| returns the average value of the chosen variable or the expression excluding SYSMIS |
| return average value for the row/column, accounting for the missing values |
| means AVG Post and returns the average value of the chosen variable or the expression after masking was applied |
| returns the average value from a weighted base |
| returns the value of a particular cell by specifying ‘column, row’ OR ‘row, column’ respectively, using commas |
| returns the correlation coefficient of two cell ranges. See the example below |
| returns the number of rows or columns with variable values in the table; series with MATH or logical expressions are excluded from counting |
| returns the number of rows or columns with variable values, accounting for the missing values |
| returns cumulative totals for rows/columns |
| takes a row/column as an input and produces a row/column with the linear approximation. It returns a line that fits the provided points. |
| returns the largest value in a set of values |
| returns the label of the largest value in a row/column |
| returns the median value of all series |
| returns the smallest value in a set of values |
| returns the percentage rank of a value in a row/column |
| exponentiation
|
| returns the rank of a value in a row/column. See the example below |
| returns the perpendicular rank of the value: the rank within the row will be displayed in the column and vice versa. See the example below |
| returns a value in a row/column rounded to an indicated decimal point |
| returns the value of the sum of the given set of variables |
CORREL calculations
Unlike the CORREL metric, the mathematical formula for calculating the correlation coefficient is applied not to a single cell, but to two ranges of cells. Here is an image with an example of how CORREL is calculated for the range of Brand-1 (Range 1) and other brands (Range and Range 3).

RANK and RANK P. calculations
Here, the ranking calculation range for brand 3 is highlighted in green, and the perpendicular ranking calculation range for brand 3 is highlighted in yellow. Thus, in the case of regular rank, the rank in the column is calculated. In the case of perpendicular, the rank within the row will be displayed in the column.
