Building complex pre-filters and post-filters in the Factory

When working in the Data Manager task, complex pre-filters or post-filters allow you to combine multiple filter statements with AND/OR conditions via the Indent selection feature.

For example, you can create two different filter groups that have to comply with different conditions.

The innermost filter conditions (closest to the attributes) have the highest priority, so filtering conditions need to be read outwards.

You can switch between AND/OR by clicking on the indent bar.

The Indent selection can be interpreted as putting brackets around an operation in algebraic expressions, defining its priority over the others.


Prerequisites


Procedure

  1. In the pre-filter or post-filter area, select the attributes you want to place in the same condition.

  2. Right-click the attributes, or click on the three-dotted button to open the context menu.

  3. Select Indent selection: the AND filtering operator is applied by default to the selected attributes: to switch to OR click on the AND filtering condition.

  4. Click Make persistent to effectively apply this filtering operation to the dataset.

  5. Save and compute the task.

To delete the indent operation performed, you can click the Unindent selection button.


Example

The following example uses the Adult dataset.

After having set the filters for each attribute, we can start using the Indent selection option.

In the following example, we want to filter the dataset to include two targeted groups that have been identified for a campaign:

  • men younger than 28;

  • women over 28.

All selected rows must belong to one of the two sets of conditions.

Step

Screenshot

Filter age and sex for men younger than 28, or sex and age of women older than 28: this means that the software will filter the sex and age attributes twice, then both filter condition groups will be displayed, as the outer condition is or:

  • Age < 28;

  • Sex = Male;

  • Age > 28;

  • Sex = Female.

  • After having set the filters, select the attributes you want to indent by clicking on them. This procedure is important in order to enable the indent selection button in the pre-filter context menu.

  • In the example here, we have selected the age + sex attributes.

  • Open the context menu by clicking on the three-dotted button next to the attribute and click Indent selection.

  • Repeat the same operation with the other two remaining filters.

  • Click on the outer filter parameter to switch it to or.