OR filters in Interactive Mode

Variables

Once there’s at least one filter added to the Filters section in Interactive Mode, an OR button will appear below the Filter box. If you’d like your results to fit all filter conditions, add subsequent filters to the same Filters box. Any filters in this same field will have an AND operator between them.

If you’d like your chart to include results fitting different conditions, you’ll want to add them to a different Filters field using an OR filter. To do this, click the OR button and drag your column to the new Filters field.

Add an OR Filter in Interactive Mode

Once you drag a column to the OR filter field, another OR button will appear beneath it. You may add as many OR boxes as you need this way.

Multiple OR Filters in Interactive Mode

Examples

1. Our query results will include rows matching any of the following conditions:

  1. The Description contains the word “Ad” and “Event”. These can be in any part of the string as the wildcards (%) are placed before and after the terms;
  2. The Description contains the word “Web”;
  3. The Cost is more than 100.

Interactive Mode:

Add AND and OR operators as filters - Example 1

SQL:

where Description like '%Ad%'
and
Description like '%Event%'
or
Description like '%Web%'
or
Cost > 100;

2. Our query results will include rows matching any of the following conditions:

  1. The Description is null;
  2. The Description is not “Sales” and is not “Print”.

Interactive Mode:

Add AND and OR operators as filters - Example 2

SQL:

where Description is null
or
Description not in ('Sales', 'Print');

3. Our query results will include rows matching any of the following conditions:

  1. The Cost is greater than 100 and the Description includes the words “Event”;
  2. The Cost is greater than 100 and the Description is not null.

Interactive Mode:

Add AND and OR operators as filters - Example 3

SQL Mode:

where Cost > 100
and
(Description like '%Event%'
or
Description is null)

Because each section has an OR between it, we’ll need to do something a little different to get this to work in Interactive Mode: we’ll add our AND filter for Cost to both OR sections. This will ensure that only results that have a Cost of more than 100 AND either Description options will be included.

In SQL Mode, you can simply wrap the two OR options in parentheses to get the same results.


Related Variables Help Articles

See more