Syntax for filter expressions

IMPORTANT

Read more about Data Workbench’s End-of-life announcement.

A filter is an expression that defines a subset of the data in a dataset.

A filter either admits or rejects each element of each dimension according to the relationships between dimensions.

Filters can be edited using the Filter Editor. See Filter Editors.

In the following table, each syntax description includes an example of a metric expression using that filter. For example, Sessions[True] is a metric defined using the “True” filter. The Sessions[True] metric is the same as the Sessions metric because the True filter admits every element of the Session dimension.

True

Constant filter. Admits every element of every dimension

Example: Sessions[ True ] is the same as Sessions.

False

Constant filter. Rejects every element of every dimension.

Example: Sessions[ False ] is always zero.

not Filter

Admits elements that Filter rejects.

Example: Sessions[ not Page=”A” ] is the number of Sessions that did not visit page A.

FilterA and FilterB

Admits elements that FilterA and FilterB admit.

Example: Sessions[ Page=”A” and Page=”B” ] is the number of Sessions that visited both page A and page B.

FilterA or FilterB

Admits elements that FilterA or FilterB admit.

Example: Sessions[ Page=”A” or Page=”B” ] is the number of Sessions that visited page A, page B, or both.

Filter by Dim

Admits the set of elements of the dimension Dim that are admitted by Filter.

Example: Sessions[ Page=”/home” by Visitor ] is the number of Sessions belonging to a Visitor that saw the Page “/home”.

Identifier

Reference filters defined otherwise in the profile.

Example: Sessions[ Broken_Session_Filter ] is the number of Sessions admitted by the Broken Session Filter.

Dim = “Value”

Admits the given element of the dimension Dim.

Example: Sessions[ Page=”A” ] is the number of Sessions that visited Page A.

Dim <> “Value”

Dim != “Value”

Admits every other element of the dimension Dim.

Example: Sessions[ Page<>”A” ] is the number of Sessions that visited any page other than A.

Dim = #Ordinal

Admits the element of the dimension Dim with the given ordinal value.

Example: Sessions[ Month=#0 ] is the number of Sessions in the first month of the dataset.

Dim <> #Ordinal

Dim != #Ordinal

Admits every other element of the dimension Dim.

Example: Sessions[ Session_Value <> #0 ] is the number of Sessions having a nonzero Session Value.

Dim matches “Expr”

Admits the elements of the dimension Dim matching the given regular expression. Dim must not be a denormal or countable dimension.

Example: Sessions[ URI matches “.*/product/.*” ] is the number of Sessions that visited any page in a product directory.

Dim notmatches “Expr”

Admits the elements of the dimension Dim not matching the given regular expression. Dim must not be a denormal or countable dimension.

Example: Sessions[ URI notmatches “.*\.jsp” ] is the number of Sessions that visited any page which was not a JSP page.

Dim < “Value”

Admits the elements of the dimension Dim with ordinal values less than the ordinal value of the element “Value.” If “Value” is not an element of dimension, then it is assumed to be larger than any current element of the dimension.

Example: Sessions[ Month < “Jul ‘04” ] is the number of Sessions that took place before July 2004.

Dim > “Value”

Admits the elements of the dimension Dim with ordinal values greater than the ordinal value of the element “Value.” If “Value” is not an element of dimension, then it is assumed to be larger than any current element of the dimension.

Example: Sessions[ Month > “Jul ‘04” ] is the number of Sessions that took place after July 2004.

Dim <= “Value”

Admits the elements of the dimension Dim with ordinal values less than or equal to the ordinal value of the element “Value.” If “Value” is not an element of dimension, then it is assumed to be larger than any current element of the dimension.

Example: Sessions[ Session_Number <= “2” ] is the number of Sessions that were the first or second session for a visitor.

Dim >= “Value”

Admits the elements of the dimension Dim with ordinal values greater than or equal to the ordinal value of the element “Value.” If “Value” is not an element of dimension, then it is assumed to be larger than any current element of the dimension.

Example: Sessions[ Session_Number >= “5” ] is the number of sessions that were the fifth or greater session for a visitor.

any Dim

Admits all elements of the dimension Dim.

Example: Sessions[ any Page_View ] is the number of sessions with at least one page view.

no Dim

Admits elements that any Dim rejects.

Example: Sessions[ no Page_View ] is the number of sessions without a page view.

(FILTER)

The same as FILTER; used to group a part of a filter expression.

On this page