This guide walks you through building filters with each of logical operators available. This guide will also mention 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 as 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 properties panel, scroll down to “Filter” section and click on “+ ADD A FILTER”. This will open the Data Studio filter creation window:
First, give a descriptive and unique name to your filter, so you can easily use it in the same report, for other elements. Next, choose the filter functionality - either “Exclude” or “Include”, which work as the name indicates: Inclusive filters look for results matching your values and include them in the results, exclusive filters do the opposite, looking for results that match your values, and dropping them out of the results.
Next, choose the field to filter by (you can use any field available for filtering). After choosing the field, select your Condition (please see “Conditions explained” below) and finalise the filter by adding the value (or several values, for some filters). Once you are happy with your filter, click SAVE.
You can add multiple filters to a single query. To do this, simply choose either “AND” or “OR” join. This will open the new filter entry fields, and also decide how your two filters will behave. 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.
To edit a filter, click the Pen icon next to it on the properties panel:
TIP: you can add, edit or remove filters by clicking on "Resource" and choose "Manage filters":
Make the changes you want, and click "CLOSE" from top left.
- Letter case is irrelevant in Equal to (=), Contains and In conditions (meaning that “AFFILIATE CAMPAIGN 2020” and “affiliate campaign 2020” will both get the same results).
- In some cases & connectors, this may change, so if your filter is not working, try to match the letter case of the target (example: if you are trying to match "Awareness", but filter "awareness" will not work, try with "Awareness").
- Letter case is relevant in Starts with, RegExp Match and RegExp Contains conditions (meaning that if your campaign name is “Affiliate program”, then filter value “affiliate” will not produce expected results - you will need to use capitals where appropriate. “Affiliate” will work).
Additional info on Data Studio support:
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.
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.
The “Starts with” condition takes your value, and compares it to the results, matching from the beginning of the string only. All matching values will be shown/discarded.
The RegExp Match operator takes the regular expression string you enter into the Value-field and compares it to the results. Results that match the string completely will be shown/discarded.
Sources for learning about regular expressions can be Googled easily. Here is one example:
The “RegExp Contains” condition takes the regular expression that you have entered, and matches it to any part of the results - if the part matches, the results will be shown/discarded.
For more information on regular expressions, check links on “RegExp Match” above.
With the “In” condition, you can enter several different options separated by a comma. “In” works like “Equals (=)” in the sense that your value must match the result value exactly (except for letter case) to work as expected.
NOTE: if your filter values contain commas, they will not be read correctly. Each comma in the value field will be read as a stop for previous value and start for next. For example, a campaign name “My First Campaign, Winter and Fall” will be read as two values for the filter - My “First Campaign” and “Winter and Fall”.
The “Is Null” condition will look at the results and show/discard only the rows where the chosen field value is Null (not text “Null”, the value must actually be missing - e.g. Null).
Common issues with filters
If your filter is giving you the "No data" error, or is producing wrong results, it is most likely due to mistake in the set up. Please check the following most common errors, and double check your filter set up.
TIP: A good way to troubleshoot your filter is to make sure the field used in your filter is selected also in the query as a metric or a dimension. Remove the filter, run the query and see if the results for that field would be caught by your filter or not.
- Leaving a whitespace out, or adding extra whitespace at the start/end of line. Check your string for extra or missing whitespace
- Mistakenly selecting the wrong field than what you are actually trying to filter by - double check the chosen field
- 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/
- Letter case when using regular expression filtering - other operators are not case sensitive, but both RegExp conditions 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.
- With some connectors the letter case may matter even with Equals- and Contains-conditions, so if your filter is not working, try to match the letter case of the target (example: if you are trying to match "Awareness", but filter "awareness" will not work, try with "Awareness").