This guide teaches you the basics of building filters, describes each of the logical operators available and mentions some of the most common errors and issues regarding filters.
Filtering is a way to control the end results of your query. All the fields available to you on the data source can be used in a filter. A filter is built by choosing the field to filter by, choosing the logical operator and then entering a value to filter by.
TABLE OF CONTENTS
Building a filter
On the sidebar, go to the Filter section and click on the text “Add filter” or the little plus next to it.
This will open up the first filter to be created. Choose the field you wish to filter by, choose the operator (operators explained below) to function by, and enter the filter string of your choice. For example:
Once you are happy with the filter, click “Get data” (or ”Update”, if modifying an existing query) to run the query with the filter.
In the query modification state you can make changes to the filter, or remove it by clicking the X above the filter, then clicking “Update”.
You can add multiple filters to a single query. To do this, simply click on the “Add filter” or plus icon under your filter. Now you will be presented with a choice of “AND” or “OR” join. This will decide how your two filters will behave. If you choose “AND”, then your results must match both filters in order to be shown/discarded. If you choose “OR”, then results that match either one of your filters will be shown/discarded.
Good to know:
- Letter case is irrelevant in Equals, Does not equal, Contains and Does not contain operators (meaning that “TOFU 2020” and “tofu 2020” will both get the same results).
- Letter case is relevant in Matches regex and Does not match regex operators (meaning that “TOFU 2020” and “tofu 2020” will get different results).
The EQUALS operator compares the query results to the string you enter into the Value-field, and it will include only the results that match your string completely.
Does not equal
This is the direct opposite of EQUALS. This operator will leave out matching results.
The CONTAINS operator takes the string you enter into the Value-field, compares the query results to it, and it will include only the results that have your string as a part of them (that part still has to fully match the value you enter into the filter).
Does not contain
This is the direct opposite of the CONTAINS. This operator will leave out matching results.
The MATCHES REGEX operator takes the regular expression string you enter into the Value-field and compares it to the results, leaving in the results that match your regex string.
Sources for learning about regular expressions can be Googled easily. Here is one example:
Does not match regex
The DOES NOT MATCH REGEX operator is the direct opposite of MATCHES REGEX. This operator will leave out the matching results.
Common issues with filters
1. Leaving a whitespace out, or adding extra whitespace at the start/end of line. Check your string for extra or missing whitespace
2. Mistakenly selecting the wrong field than what you are actually trying to filter by - double check the chosen field
3. Filter has a deprecated field that does not work anymore (especially happens with old reports that have not been checked in a long time). Check that the fields used are not deprecated (you can change data source on the left-hand panel): https://supermetrics.com/docs/integration-facebook-ads-fields/
4. Letter case when using REGEX filtering - other operators are not case sensitive, but both REGEX operators are, due to the nature of Regular Expressions - check that you have correct letter case, so that your filter matches the results you are trying to filter.