Skip to main content
All CollectionsData guide
Example: Create an insight with a List filter
Example: Create an insight with a List filter

Learn how to apply a filter of your insight to filter its output

Boyan Barnev avatar
Written by Boyan Barnev
Updated over a year ago

Overview

This example demonstrates how to filter the output of insights by applying a filter.

It is based on the same example as in Example: Create an insight with metrics โ€“ the Total monthly sales insight. It builds on it to include the filter.

The original insight sums the revenue of all sales opportunities that are won. This example introduces a filter. You can use the filter to filter which sales opportunities, you want to filter. For example, you may want to see what is the total amount of sales that are in progress.

To accomplish this, you first create the filter, then, include it in the insight, and, finally, use it on the insightboard to filter the data.

The example uses the List filter. This is a filter where you can select one option from a predefined list of options.
For more information, see Create filters for insightboards.


Prerequisites

To create this example, you must have first created the insight in Example: Create an insight with metrics.


Create the filter

Perform the following:

  1. In the bottom of the navigation pane, click Settings.

  2. On the Configuration tab, click Insightboard parameters.

  3. Click ADD NEW PARAMETER.

  4. In Title, enter Status filter

  5. In Key, enter status_filter

  6. In Selector, select List.

  7. Under Dynamic values, move the toggle switch to Use connected entity values.

  8. In Entity type, select sales_monthly.

  9. In Title field, select Status of deal.

  10. In Value field, select Status of deal.

  11. Click Create insightboard parameter.


Edit the Total monthly sales insight

Perform the following:

  1. In the navigation pane, expand Insights and click Insightboards.

  2. In the toolbar, click Manage insights.

  3. Find the Total monthly sales insight and expand its menu.

  4. Click Edit insight.


Edit the SQL to include the filter

The SQL editor, enter the following query:

SELECT SUM(sale_rev) as total_won
FROM sales_monthly
WHERE
CASE WHEN '%%status_filter%%' <> ''
THEN sale_stage = '%%status_filter%%'
ELSE false END

Do not change the HTML of the insight and click Save and leave.

For more information, see Sample filter syntax and Create insights with SQL.


Apply the filter

The filter is created and you can apply it on the insightboard.
Perform the following:

  1. Navigate to the insightboard that contains the insight.
    In the toolbar, you can see the new filter.

  2. Click the filter, select in progress, and click Apply selection.
    The output of the insight changes to $2,000.00.

  3. To save the filtering, click Save filters.

For more information, see Filter the output of insights.

Did this answer your question?