This article shows you how to create a 2.x global filter, and then create similar results using a 3.x pre-filter.
- 2.x global filter is applied at the dataset level, and affects both the query itself and any underlying named expressions (knowledge objects in Scuba 3.x).
- 3.x pre-filter is applied to functions of a query, filtering for a specific set of events.
This article demonstrates the following tasks:
A 3.x event pre-filter is similar to a 3.x custom event property.
Creating and applying a 2.x global filter
Global filters are applied to every query. You must have the Publisher or Admin role to create and edit global filters. With Publisher or Admin privileges, you can also set a global filter to be applied by default, so it is applied automatically to all queries.
As with regular filters, you can use the basic or advanced filter syntax to define the filter parameters.
To create a global filter, do the following:
- In a browser window, enter the following to bring up the Global Filters window.
- In the upper right corner, click New Global Filters. The New Global Filter dialog appears.
- Enter a Name for the new global filter, then select a Dataset from the drop-down list.
We named our New Global Filter iDevices and selected the movies database.
- Select the type of Filter you want to create, Basic or Advanced, then click inside the text field and select the appropriate options for the global filter.
In our example, we created a Basic filter where device_type is one of iPad, iPhone, or Safari.
- Enter a Description for the global filter.
- Optional: Click + to Add another filter.
- Optional: Click the Apply Filter By Default check box.
Selecting the Apply Filter By Default check box will automatically apply the global filter to all queries.
- Click Save.
You can add or remove Global Filters defined for a dataset. Filters marked as default will be applied automatically.
To apply a global filter, do the following:
- Open Explorer and select a Dataset and View. We chose the movies database and Time view.
- Click inside the Global Filters field and select a global filter from the drop-down list. We selected iDevices, the global filter we created in the previous task.
- Optional: Click the X next to the filter name to remove a filter, and click Restore to add back any default filters that you have removed (Restore only works for filters defined as default filters).
- Specify a Start and End time, or highlight data in the time scrubber, as we did in our example.
- Select a Measure from the drop-down list. We chose Count Events for our example.
- Click inside the Groups field and select a Compare option. We chose to compare (filter) device_types with iDevices.
- Optional: Specify another filter. We did not specify another filter in our example.
- Optional: Click Chart Options, deselect the Sampled Query radio button, and click Apply. We ran an unsampled query in our example for optimum results from our data.
- Click GO. We received the following results in our example.
Using a 3.x event pre-filter
A 3.x event pre-filter can be applied to the functions of a query. A pre-filter filters out all events—except those specified by the pre-filter—then processes the other query functions. This ensures that the query results focuses on only the events you are interested in.
To use a 3.x event pre-filter, do the following:
- Open Explorer, then in the upper left corner of the window select a dataset from the drop-down menu. We selected the movies dataset for our example.
- In measure 1, select Show function options, and then select an option to Filter to. We chose to Show count of events Filtered to all events in our example.
- Select measure 1 text and enter a unique name for the measure. We named the measure Count of events.
- Specify Split by (group by) options. We chose to split by device_type. and accepted the default Limit of 25 and Ordered by option of Count of events descending.
- Specify Starting and Ending times, or highlight the data in the time scrubber as we did in our example.
- Select Pre-filter and specify the pre-filter options. We chose to Pre-filter to events with device_type that matches iPad, iPhone, or Safari.
- Toggle Sampled to All—for unsampled query results—and then click GO.
We received the following results for our example.