View the original community article here
Last tested: May 2020
Most of these examples can be found in the filter expressions doc.
Filter out NULL values for non-number dimensions
The most common filter syntax to filter out nulls is simply "-NULL"
. This works for most data types that aren't numbers, such as strings, dates, etc.
measure: count {
type: count
filters: {
field: user.status
value: "-NULL" # assuming that user.status is a string
}
}
Filter out NULL values for number dimensions
For type number, use NOT NULL
instead.
measure: count {
type: count
filters: {
field: user.age
value: "NOT NULL" # assuming that user.age is a number
}
}
Filter out the string "NULL" from a string dimension
What if your string dimension literally has the string "NULL" in it? (As opposed to a real null (Ø)) Then you'll use this special syntax:
measure: count {
type: count
filters: {
field: user.status
value: "-'NULL'" # assuming that user.status is a string that actually has 'NULL" as a value
}
}
This content is subject to limited support.