Skip to main content
Skip table of contents

Create a Math Field

A math field is a mathematical operation involving measures or other user defined fields.

To create a math field:

  1. Select Cross > Define Field. The Define Fields window displays.
  2. Click Math. The Math Field window displays.
  3. Enter the following details:

    FieldDescription
    Field NameEnter a name for the field.
    Create Field ForSelect the database table to create the field for.
    Formula

    Create the mathematical formula. You can either type the formula into the field, or you can use the buttons at the bottom to include the fields or available mathematical operators.

    Use the codes (e.g. V1 and V2) to represent the fields in the formula.

    Operators

    Click the buttons in the Operators section to add one of the mathematical operators to your formula (or simply type the operators into the Formula field).

    To add one of the advanced mathematical operators, select it from the drop-down list and click Add.

    The following advanced operators are available:

    roundRounds values.
    lnCalculates logarithmic values base e.
    expCalculates exponential values base e.
    sqrtCalculates the square root.
    nullaszeroConverts a null value to zero. Other input values are not affected and are preserved.
    isnullReturns 1 if the input is null, otherwise returns 0.
    notReturns 1 if the value is 0, otherwise returns 0.
    CheckWhen you have finished creating your formula, you can click Check to test that it is mathematically valid.
  4. Click OK.

Math Fields and Null Values

The default behaviour is that any mathematical operation involving an undefined value results in an undefined (null) value for the calculated unit record value of the user defined field.

For example, if a table has two numeric columns and you use a math user defined field to sum the values in these columns, then the tabulation engine sees a table that looks like this:

Col1Col2Math UDF Col1 + Col2
112
1NullNull

When tabulated and summed the columns display as:

Col1Col2Math UDF Col1 + Col2
212

You can use the nullaszero, isnull, and not operators to detect and handle null values in a math field.

JavaScript errors detected

Please note, these errors can depend on your browser setup.

If this problem persists, please contact our support.