One of the recent charting improvements is the ability to add filters to a chart, however it’s not a very well known feature, so here’s a little guide on how to use it.

In a view, you can add ‘ad-hoc’ filters using the filter inputs at the top of the screen. In this screenshot for example, we’re searching for all organisations in the food and drink sector, who are distributors and customers.

view_screenshot

If you switch to see charts based on that view, they’ll have the same filters applied. However, what’s new is that you can also ‘hard-code’ whatever filters you like into charts when editing them. This particularly becomes useful when adding multiple charts to a view.

So working on the example of the above view, you could add two charts, one a chart of the number of ‘food and drink’ customers added over time, another of ‘education’.

Adding a filter to a chart

When editing a chart, click ‘advanced settings’ and type in a filter into the ‘additional filters’ box, in the format fieldname=value.

simple_filter

The value can be anything that you’d type into a filter box at the top of the screen, when narrowing down records. It can contain advanced filter commands, so e.g. a colon means ‘starts with’, an exclamation mark means ‘not’. Just remember that the equals sign separating the field from the filter value is not part of the filter value. So you can use the following formats:

  • fieldname=value : field contains ‘value’
  • fieldname=:value : field starts with ‘value’
  • fieldname=!value : field does not contain ‘value’ (fieldname=not value can also be used)
  • fieldname=? : field is empty, no value has been set
  • fieldname=!? : field has a value (it’s not empty)
  • fieldname==value : field is exactly equal to value (case insensitively)
  • fieldname=>value : field is greater than or equal to value (useful to numbers and dates, but also applies to text)
  • fieldname=<value : field is less than value
  • fieldname=value1 OR value2 OR value3 : field contains any of the specified values
  • fieldname=value1 AND value2 AND value3 : field contains all of the specified values, in any order

Multiple filters

Multiple filters can be added by separating them with commas. For example, the filter

  • sector serviced=food and drink, industry=distributor, date added=>12 months ago

would apply all three of those filters to the chart.

Ad-hoc filtering

What happens when you type in searches into the filter boxes at the top of the screen, when looking at a chart?

The filters get applied in addition to any filters saved into the chart as above. If you filter on a field which is already included in a chart, the filter that you type will temporarily override the filter saved to the chart.

Advertisements