Skip to main content
Skip table of contents

Comparisons & boolean logic

Overview

Comparisons and boolean (logical) operators turn numeric node values into conditions (true/false as 1/0). Use them to flag data and drive branching logic, most commonly inside IF(...).

Start here if…

  • You want to create a threshold.

  • You want to combine conditions.

  • You’re writing the condition part of IF(condition, value_if_true, value_if_false).

What you’ll find on this page

  • A quick reference of comparison operators (like >, =, !=) and what they return.

  • A quick reference of boolean operators (AND / OR / NOT / XOR) and TRUE / FALSE helper functions.

  • How conditions are evaluated (0 vs non-zero) and how missing values can affect results.


Mental model

  • Comparisons compare matching rows and return 1 (true) or 0 (false).

  • Boolean operators combine or invert conditions and also return 1/0.

  • TRUE('Node')/ FALSE('Node') returns 1/0 wherever 'Node' is defined.

  • IS_NA('Node') returns 1 where 'Node' is undefined (and can expand result size).

  • In IF(...), 0 is interpreted as false and any other value as true.


Operator reference

Comparison operators

Operator

Function equivalent

Details

Returns 1 when…

=

EQ(a, b)

EQ (=)

values are equal

!=

NEQ(a, b)

NEQ (!=)

values are not equal

>

GT(a, b)

GT (>)

left is greater than right

>=

GTE(a, b)

GTE (>=)

left is greater than or equal to right

<

LT(a, b)

LT (<)

left is less than right

<=

LTE(a, b)

LTE (<=)

left is less than or equal to right

Syntax tip: Many comparisons can be written either as a function call or as an operator expression (for example GT('A','B') or 'A' > 'B').

Boolean operators

Operator

Function equivalent

Details

Returns 1 when…

AND / &&

AND(a, b)

AND

both inputs are true

OR / ||

OR(a, b)

OR

at least one input is true

NOT

NOT(a)

NOT

input is false (0)

XOR

XOR(a, b)

XOR

exactly one input is true

These operators are most commonly used inside IF(...) conditions.

Defined/undefined helper functions

Function

Details

Returns

TRUE('Node')

TRUE

1 on defined intersections

FALSE('Node')

FALSE

0 on defined intersections

IS_NA('Node')

IS_NA

1 on undefined intersections


Common patterns

  • Flag positive values: 'Value' > 0

  • Combine thresholds: ('Margin' < 0) OR ('Revenue' = 0)

  • Branching logic: IF('Net Income' > 0, 'Net Income' * 'PayoutRate', 0)

  • Truthiness shortcut (0 vs non-zero): IF(‘Delta’, 1, 0) treats any non-zero Delta as true (including negatives).

  • Always take 'A' where a node is defined: IF(TRUE('Sales'), 'A', 'B')

  • Find missing intersections: IS_NA('Sales') (returns 1 where values are undefined)


Pitfalls & troubleshooting

  • Truthiness surprises: In conditions, 0 is false and any non-zero is true, so “boolean” inputs don’t need to be strictly 0/1.

  • Undefined values: Comparisons can treat undefined values as false.

  • TRUE/FALSE only cover defined rows: TRUE('Node') and FALSE('Node') apply only where 'Node' is defined. If you need a flag for undefined rows, use IS_NA('Node').

  • Cube size risk: IS_NA returns a fully expanded cube and can hit maximum cube size.

  • Dimensional mismatch: Some boolean functions (for example XOR) have strict dimensionality constraints that can exclude inputs or produce unexpected results when granularities differ.


Related sections

  • Operators overview + navigation to arithmetic vs comparisons/boolean logic.

  • IF (Logical functions): how conditions are interpreted and how branching works.

  • Formula basics parentheses, evaluation order, and quoting rules for node references.

  • Troubleshooting guide diagnose wrong shape vs wrong numbers vs empty output (especially around missing values).

JavaScript errors detected

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

If this problem persists, please contact our support.