Newer Version Available

This content describes an older version of this product. View Latest

Comparison Operators

Use comparison operators to compare values.

Comparisons are defined for values of the same type only. For example, strings can be compared with strings and numbers compared with numbers.

Operator Name Description
== Equals True if the operands are equal. String comparisons that use the equals operator are case-sensitive.
!= Not equals True if the operands aren’t equal.
< Less than True if the left operand is less than the right operand.
<= Less or equal True if the left operand is less than or equal to the right operand.
> Greater than True if the left operand is greater than the right operand.
>= Greater or equal True if the left operand is greater than or equal to the right operand.
matches Matches True if the left operand contains the string on the right. Wildcards and regular expressions aren’t supported. This operator is not case-sensitive. Single-character matches are not supported.
For example, the following query matches airport codes such as LAX, LAS, ALA, and BLA:
1my_matches = filter a by origin matches "LA";
in In If the left operand is a dimension, true if the left operand has one or more of the values in the array on the right. For example:
1a1 = filter a by origin in ["ORD", "LAX", "LGA"];
If the left operand is a measure, true if the left operand is in the array on the right. You can use the date() function to filter by date ranges.

If the array is empty, everything is filtered and the results are empty.

Ranges that are out of order (for example, in ["20 years ago" .. "2016-01-11"] or in ["Z" .. "A"] ), evaluate to false.

not in Not in True if the left operand isn’t equal to any of the values in an array on the right. The results include rows for which the origin key doesn’t exist. For example:
1a1 = filter a by origin not in ["ORD", "LAX", "LGA"];

Example

Given a row for a flight with the origin “SFO” and the destination “LAX” and weather of “rain” and “snow,” here are the results for each type of "in" operator:

weather in ["rain", "wind"] = true

weather not in ["rain", "wind"] = false