Working with Filters
Filters let you slice and dice you data in powerful ways. These are useful when you want to narrow the dataset you're working with by either measures or dimensions.
For example, you are trying to visualize new user signups, but only want to see signups from a particular ad campaign. You would then drag your campaign column to the filter box and set the value input on the right hand side to the relevant campaign name. Or you might want to see a list of employees making above a certain salary and compare that to sales data.
Above, we see an example of a dataset with an additional filter. The filter narrows down the total number of comments our website has received to reflect only comments with a score equal to 7.
Alternatively, we could filter our our comments by their score using a wide selection of operators.
In order from top to bottom, these operators are:
- Equal to
- Less than
- Greater than
- Not equal to
- Greater than and equal to
- Less than and equal to
- Like
The "Like" Operator
The "like" operator refers to The LIKE condition in SQL. It lets you use wildcards in the WHERE clause of a SQL statement so you can perform pattern matching. The two valid patterns for LIKE use the symbols _ or %.
The % symbol allows you to match any string of any length (including zero length).
Examples:
Jackie% would find any string that begins with "Jackie" and %bob% would find any string that contains the characters "bob"
The _ symbol lets you match on one character.
Examples
1332_ would return all order numbers beginning with 1332. So,
13324 13325 13326 etc.
.
Here we are searching for posts to our website that contain the string "Awesome"
Multiple Filters
You can add as many filters as you'd like to any given dataset.
Here is a second filter that has yet to be populated with data.
*Note: Before you add a subsequent filter, the previous filter needs to contain data.
Under the Hood
When you create a filter using Chartio's visual UI, you are adding a WHERE clause to the SQL query being generated in the background.
When you add multiple filters in visual mode, you are adding multiple WHERE clauses connected by an "And" operator. Chartio does not yet support the use of the "Or" operator to join multiple WHERE clauses. However, you can always add it directly in raw SQL.
