XOR

XOR('Node1', 'Node2')

In Logical functions

The XOR function 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 this function when you need a 1/0 flag that becomes true only if exactly one of two inputs is true.

Parameters

Node1Node referenceRequired
First input node, specified using the node name in single quotes (e.g. 'Profit').
Node2Node referenceRequired
Second input node.

Watch out

  • Both input nodes must have the same dimensionality; otherwise rows are excluded from the function output.
  • 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.

Node formula and Data Preview showing an XOR of two EXPANDSINGLE inputs with mismatched granularity, illustrating the limitation

Example

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'

YearValue
202517
20260
20270
20281

Input node: 'B'

YearValue
20251
20260
20271500
20280

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

YearXOR Result
20250
20260
20271
20281

See also

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.
Was this page helpful?