Insightboard filters are a convenient way to dynamically narrow down the displayed data in an insight without having to edit its SQL code. To filter your insights you need to:

This article explains how to write your insight SQL with filters, and how to use the filters to narrow down the data displayed by your insights.

Add filters to your insight SQL

Once you created your insightboard parameters (here you can learn how), the next step is to include them in an insight. Follow these steps:

  1. Navigate to Insights -> Insightboard and open the insightboard which contains the insight/s you would like to add a filter to. If you do not know how to create an insight, have a look at this article.
  2. From the three dotted selector on top choose Re-arrange (or simply press E on your keyboard) and edit the insight from the middle button (</>)
  3. Once you are in the insight editor, add an insightboard parameter by introducing a WHERE clause. Assume the name of our parameter is param_name. The syntax for getting the filter’s value is %%param_name%%’. In the examples below for entity field, it will be used field_name, but you can input an entity field that suits your filter. For examples of specific filter, syntax refer to the Sample filter syntax paragraph below.
  4. Once you add the filter in your SQL, you can click Execute to check if your syntax is correct.
  5. If you do not see any errors, then you can press Save and leave. You are ready to filter!

Filter your insightboard data

Insightboards automatically display all filters that exist in the SQL of the insights from that board. Once you open an insightboard, if your filter does not have predefined display value, you will see “None selected” under your parameter title. To filter the insights on the insightboard select a value from any of the filters. Users without Update permissions for the Insightboard cannot change the filter's value.

NOTE: When you use a filter it applies to all insights in the insightboard that contain this filter.

Saving your filter selection

When you open the filter and select a value, it will show you the desired results, but it will not save your preferences automatically. Therefore, if you would like to see the information with those selected filters the next time you open this insightboard, press Save filters before leaving the board or refreshing it.

Sample filter syntax

In this paragraph, you can see the syntax for the most common filter types

Free text field

This filter type creates an input field in the filter and you need to manually type in your filter value

Syntax:

CASE WHEN '%%param_name%%' <> ''
  THEN field_name like '%%param_name%%'
  ELSE false END


In this case if nothing is selected, no values will be displayed. You can change the behavior by changing the condition after ELSE - set it to true (then all values will be displayed), specific value or another condition. This is the case for all the following syntaxes, so keep it in mind when applying the rest of the snippets. 

Date picker

This filter type allows you to filter your information for a specific date 

Syntax:

AND CASE WHEN '%%param_name%%' <> ''
  THEN field_name = '%%param_name%%' ELSE false END

Date-range picker

This filter type allows you to select a custom time period

Syntax:

AND CASE WHEN '%%param_name%%' <> ''
  THEN field_name @@ '%%param_name%%' ELSE false END

List

This filter type allows you to select only one value from this filter

Syntax:

CASE WHEN '%%param_name%%' <> '' 
  THEN field_name = '%%param_name%%'
  ELSE true END

Multi-select dropdown

This filter type allows you to select multiple values from a list

Syntax:

CASE WHEN '%%param_name%%' <> ''
    THEN (field_name in (SELECT(UNNEST(string_to_array('%%param_name%%', ',')))))
    ELSE true
    END


Did this answer your question?