Skip to main content
Skip table of contents

XOR

Category: Logical functions

Overview

Description

Connects two inputs with the logical ‘exclusive or’ XOR and returns true (1) if exactly one of the input values is true and false (0) otherwise.

Use when you need a 1/0 flag that becomes true only if exactly one of two inputs is true.

Syntax

XOR('Node1', 'Node2')

Parameters

  • Node1: First input node, specified using the node name in single quotes (e.g. 'Profit').

  • Node2: Second input node.

Limitations

Both input nodes must have the same dimensionality; otherwise rows are excluded from the function output.


Examples

Typical use

This example shows that XOR returns 1 only when exactly one input is true. If both inputs are true or both are false, the result is 0.

Input node: A

Year

Value

2025

17

2026

0

2027

0

2028

1

Input node: B

Year

Value

2025

1

2026

0

2027

1500

2028

0

Formula: XOR('A', 'B')

Year

→ XOR Result

2025

0

2026

0

2027

1

2028

1


Limitations

Both input nodes must contain the same levels, otherwise the function will consider only the more granular function while ignoring the function with fewer levels.

Example of the limitation: The function is given two EXPANDSINGLE() inputs. However, one of the EXPANDSINGLE() functions possesses more levels than the other, resulting in different granularity. The function with more levels is the leading function. This leads to unexpected outputs from the XOR() function.


Related Functions

Function

When to use instead

OR (||)

When at least one of the two inputs may be true instead of requiring exactly one to be true.

AND (&&)

When both inputs must be true at the same time instead of exactly one of them.

JavaScript errors detected

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

If this problem persists, please contact our support.