In Part 2 we set the context for filtering with multiple criteria:
- Two or more filters are established, and connected through AND, or OR logic
- Data is pushed through the filters, which outputs "True" or "False"
- All data points that resulted in a "False" output are hidden
Here, we'll introduce the context for binding filter logic together. For example, let's pretend you're working with the following dataset:
Age: 10, 12, 25, 30, 60
A question you could ask about this dataset (which would ultimately be answered by use of multiple filters and binding logic) would be:
How many ages are equal to 10, or are greater than 15 and less than 50?
It's subtle, but there are two separate filters being asked for in the above question. If either outputs "True, that data will be kept. Because of this, we need to bind our second filter to itself so that it's fully isolated from our first filter. Below is how we bind filter logic together:
Used to bind pieces logic together to make them fully independent
Behind the scenes, when you apply a filter to a dataset each value is checked against your rule. In our example, the following would occur:
10 = 10 OR (10 > 15 AND 10 < 50) True
12 = 10 OR (12 > 15 AND 12 < 50) False
25 = 10 OR (25 > 15 AND 25 < 50) True
30 = 10 OR (30 > 15 AND 30 < 50) True
60 = 10 OR (60 > 15 AND 60 < 50) False
Everything that outputs "False" is removed, leaving us with three results (and the answer to our question).