Example: Filter data with virtual data sources

Learn how to use virtual data sources to filter data across multiple insights

Neli Ivanova avatar
Written by Neli Ivanova
Updated over a week ago

Overview

In this example, your company uses JIRA heavily. You have multiple projects and they are divided in two categories:

  • Internal
    Where you track issues internally

  • Service Desks
    Where people outside of the company report issues

All issues across all projects are synced in one data source jira_issues. You want to have different insights for internal projects and service desk projects.


Approach 1: Filter the issues from the insight

You can filter the tasks from within each insight. You can use the following SQL queries:

For internal projects:

SELECT * FROM jira_issues WHERE projectname like '%Internal%'

For service desk projects:

SELECT * FROM jira_issues WHERE projectname like '%Service Desk%'

You have to repeat this operation across all insights that separate the two types of issues. If you change the naming convention of the projects, you have to go over all of them again.


Approach 2: Filter the issues with virtual data sources

By creating a virtual data source for each types of projects, you can control the changes from a single place.

Perform the following:

  1. Create a virtual data source for the internal projects.
    Define its key as internal_jira_issues.
    For more information, see Create virtual data sources.

  2. In the SQL editor, enter the following:
    ​ SELECT * FROM jira_issues WHERE projectname like '%Internal%'

  3. Create another virtual data source for the service desk projects.
    Define its key as service_desk_jira_issues.
    In the SQL editor, enter the following:
    ​ SELECT * FROM jira_issues WHERE projectname like '%Service Desk%'

  4. In the SQL of the insights, depending on the type of issues that you want to handle, use one of the following:
    ​ SELECT * FROM internal_jira_issues
    or
    ​ SELECT * FROM service_desk_jira_issues

For more information, see Create insights with SQL.


Example

The following diagram demonstrates the process:

Did this answer your question?