MOD

MOD('Number', 'Divisor' [, "Validation"])

In Math & numeric

The MOD function returns the remainder value after performing a division operation between two nodes. The input values are 'Number', 'Divisor', and an optional validation option. If no validation is required, the same result can be achieved using the % symbol, for example 'Number' % 'Divisor'. The operation is performed along the linked levels between the nodes.

Use this function when you need the remainder after dividing one value by another, for example for bucket logic or periodic patterns.

Parameters

NumberNode referenceRequired
Input node.
DivisorNode referenceRequired
Input node.
ValidationKeywordOptional
Causes the node executing the function to error with a message explaining why if conditions are not met. Note that using validation can affect performance. Default: "NoValidation".
  • "NoValidation": Behaves the same as using the % symbol. This is the default.
  • "FailOnMissingFirst": The calculation fails if any row in 'Number' is not matched with any row in 'Divisor'.
  • "FailOnMissingSecond": The calculation fails if any row in 'Divisor' is not matched with any row in 'Number'.
  • "FailOnMissing": Combines "FailOnMissingFirst" and "FailOnMissingSecond" validation options.

Watch out

  • The result of the division only returns whole numbers, such as 0, 1, 2, or 3.

Example

Modulo with missing matches and division by zero

This example shows how MOD behaves when rows are matched normally, when a divisor is zero, and when rows are missing on one side.

Input node: 'Node A'

YearVolume
202510
202610
20275
20280
20297

Input node: 'Node B'

YearVolume
20256
202610
20270
20285
20303

Formula: MOD('Node A', 'Node B')

Equivalent to: MOD('Node A', 'Node B', "NoValidation")

Equivalent to: 'Node A' % 'Node B'

YearMOD Result
20254
20260
20280

Note: The year 2027 has no result because it is not possible to perform 5 % 0, that is, divide by 0. The years 2029 and 2030 have no result because there is no corresponding value in the other node.

See also

DIVISION (/)
When you need the quotient of a division instead of the remainder after division.
ROUND
When you want to round numeric values instead of calculating a remainder.
Was this page helpful?