Skip to main content
Skip table of contents

MOD

Category: Math & numeric

Overview

Description

Modulo 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 when you need the remainder after dividing one value by another, for example for bucket logic or periodic patterns.

Syntax

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

Parameters

  • Number: Input node.

  • Divisor: Input node.

  • Validation (optional): 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. The following values can be used:

    • "NoValidation": Behaves the same as using the % symbol. This is the default option if no validation is specified.

    • "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.

Note

For this operation, the result of the division only returns whole numbers such as 0, 1, 2, or 3.


Examples

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

Year

Volume

2025

10

2026

10

2027

5

2028

0

2029

7

Input node: Node B

Year

Volume

2025

6

2026

10

2027

0

2028

5

2030

3

Formula: MOD('Node A', 'Node B') = MOD('Node A', 'Node B', "NoValidation") = 'Node A' % 'Node B'

Year

→ MOD Result

2025

4

2026

0

2028

0

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.


Related Functions

Function

When to use instead

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.

JavaScript errors detected

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

If this problem persists, please contact our support.