Notification

This Help Center is moving to Cloud. Learn more about the migration.

Operators

Operators are represented by special characters or keywords; they do not use function call syntax. An operator manipulates any number of data inputs, also called operands, and returns a result.

Arithmetic operators

  • Addition: +
  • Subtraction: -
  • Division: /
  • Multiplication: *

Comparison operators

  • =
  • !=
  • >
  • >=
  • <
  • <=

The operands on both sides of the comparison operators must of the same type: text, number or boolean. 

Logical operators

Logical operators return true, false, or null. Looker Studio supports the AND, OR, IN, IS NULL, and NOT operators. 

AND / OR

Use AND and OR to create expressions with multiple input values. Use parentheses to group conditions and force order of precedence, if needed.

Boolean expression A AND (Boolean expression B OR Boolean expression C)

IS NULL

Returns true if the input field is empty or null.

Syntax

field IS NULL

Parameters

field—the dimension or metric to evaluate.

Examples

Field contains Formula Results
a Field IS NULL false

 

Field IS NULL true

More on NULL

Unless otherwise specified, all operators return NULL when one of the operands is NULL.

NULL is different from the empty string (""). Whereas trying to use the empty string in arithmetic generally produces an error, using NULL returns the null value:

1+NULL = NULL

1*NULL = NULL

1/NULL = NULL

etc.

On the other hand, while you can concatenate values with the empty string, the result of concatenating any value with NULL is the null value:

CONCAT("A", "", "B") = "AB"

CONCAT("A", NULL, "B") = null

IN

Returns true if the input field contains any of the the listed values. Both the field and list values must be of the same type. IN matches complete values and is case-sensitive. For partial value or case insensitive matching, use REGEXP_MATCH.

Syntax

field IN (value1, value2, ... valueN)

Parameters

field—the dimension or metric to evaluate.
value1,value2,...valueN—the values to look for.
 

Examples

Field contains Field type Formula Results
Bob Text Field IN ('Bob', 'Alice') true
Alice Text Field IN ('Bob', 'Alice') true
Jorge Text Field IN ('Bob', 'Alice') false
20 Number Field IN (10, 20) true
10 Number Field IN (10, 20) true
100 Number Field IN (10, 20) false
Bob Text Field IN ('Bob', 20) error (because Field is text but 20 is a number. To fix this, put "20" in quotes.)

NOT

Negates input expressions. 

Examples

Formula Results
IF(2+2=4,"YES","NO") YES
IF(NOT 2+2=4,"YES","NO") NO
"abc" IN ("abc") true
"abc" NOT IN ("abc") false

 

 

Was this helpful?

How can we improve it?
Search
Clear search
Close search
Google apps
Main menu
7530022679695804936
true
Search Help Center
true
true
true
true
true
102097
false
false