Filters in the GoodData Platform

  • 26 June 2020
  • 1 reply
  • 496 views

Userlevel 2

Sometimes you want to analyze only a subset of your data. To achieve this you can use filters. In the GoodData platform, you can apply filters at any of the three stages of your analysis:

  • when you modify your measures (also called metrics)
  • when you build insights
  • when you display KPI dashboards

Measure level filters limit what data enters that specific calculation, insight level filters limit what data is available to all measures and attributes in that insight, KPI dashboard level filters limit what data is available to all insights on that dashboard. Only certain user roles can create and edit measure and insight level filters but all roles can change KPI dashboard level filter selections.

This gives you a wide array of options to filter data for your specific use cases.

Filter your measures

When you create or modify measures using filters, you define how your data are used for the analysis. By applying filters at this stage, you exclude specific range of data from being used for computation.

Note: To create or modify a measure you need to have at least editor level access to a workspace. See User Roles.

Let’s say that you want to add a filter to the # of Orders measure as you only want to see delivered orders.

  1. When in your workspace, click Manage, the click Metrics (another word for measures) and either create a new metric or edit an existing one.
  2. To start editing the measure click its name and, when the following screen appears, click Edit.

    MAQL metrics editor opens. This is where you change the definition of the measure.
  3. Edit the definition and add a filtering condition to it. These conditions always start with WHERE keyword (see Filtering with the WHERE Clause).

     

  4. When you are happy with the new definition, save it and start using it in your insights.
    Note: If you are already using this measure in some insights these will get automatically updated with the new definition.

If you are a Free or Growth customer, you can follow the Create a Filtering Variable tutorial and experiment with filtering within your GoodData Demo Workspace data.

Using Filters on insights

Another level you can apply your filter on is your Analytical Designer insights. By applying filters on insights, you exclude specific range of data from being used for analysis.

Note: To build/edit insights you have to have at least Explorer role. See User Roles.

Let’s say that you want to see # of Orders by the Product Category but you only want to count orders that were delivered.

You have two options here:

  • you can use the modified measure from the previous section
  • you can use an insight level filer

To use an insight level filter:

  1. Drag and drop the attribute from the list of attributes to the filter section:

     

  2. Select the value that you want in the filter.


    The chart will recompute itself.

When you save the insight, the filter and the selected value will be saved along with it.

For more details, see Filters in Analytical Designer.

Using Filters on KPI Dashboards

Another option you have is to use KPI Dashboard filters. By applying filters on KPI Dashboards, you hide specific range of data from being displayed on the dashboard.

Note: The important, and the most intriguing thing, on KPI dashboards' filter is that they can be applied by anyone who views the dashboard.

There are currently two kinds of filters available for KPI Dashboards:

Using KPI dashboard filters

To filter only on Delivered orders, use an attribute filter instead of the measure or insight level filter.

To do that:

  1. Switch to edit mode on a dashboard.
  2. Drag and drop the Attribute Filter component next to the default Date range filter component.

     

  3. Select the Order Status attribute from the drop-down menu of the Attribute Filter component.

     

  4. Once you select the attribute, you can select which values should be selected by default when a user comes to the dashboard.

     


     

Advantages of KPI dashboard filters

The important thing to realize is that all users - even viewers - can change KPI dashboard filter values.

This means that the user will be able to change the selection from for example Delivered to Returned or select all.

Note: This change of selection doesn’t modify the default values set, it only applies within that user’s session and will reset next time the user visits the dashboard. In some cases this is what you want but in some cases you don’t want viewers to be able to change the selection - in that case use a measure or insight level filters instead.

Another feature of all filters on the KPI dashboards is that you can select which insights the filters should apply to. By default, all filters apply to all insights you placed on the dashboard. If you want to prevent a specific filter from applying to a specific insight simply click on the insight and uncheck the filter you want it to ignore.

In the example above, we unchecked the date.

When to use which type of filter

There are always exceptions but the best practices are:

  • Use a measure level filter if you plan to use the same filtered metric in several insights.
    That way you only have to define the filter once instead of defining it over and over again for each single insight. Apart from easier maintenance it also standardizes the definition of the metric for everybody.
  • If you have a very specific scenario that won’t repeat or if you are just quickly prototyping, insight level filters might be what you are looking for.
  • If you are putting your insights on a KPI dashboard and want to enable the consumers of the dashboard to dynamically change the filter value, use the KPI dashboard level filter.

How do all these filters interact?

Now you might be asking what happens if you set filters on multiple levels.

All filters that apply to an insight - no matter what level they are defined on - will be connected by the AND operator. That means that a combination of the filters will apply and only rows of data that satisfy all the different filtering conditions will enter the calculation.

If, for example, the measure is filtered on Order Status = Delivered and the KPI dashboard filters on Order Status = Canceled the insight won’t return any data as each order is associated with a single Order Status value in our case.

Common Pitfalls

You might get into a situation where you add a filter but it doesn’t change the numbers. This typically means that you are trying to filter on something that is not connected to the data points that you are using in your measures/insights in the LDM (logical data model). To learn more about the LDM Modeler and data modeling on the GoodData platform, see Data Modeling in GoodData.


1 reply

There is good to know that filters are applied “in order of appearance” - independent dashboard filters (= filters w/out Parent Filter set) in the first row, filters w/ Parent filters just after Parent filter. report filters from the first to the latest one. Measures / metrics can override this filtering, see MAQL documentation. 

When dashboard report is opened outside dashboard for verification purposes, some dashboard filters are affecting results of filtering by metric if present in report. It affects measures which count records or sum facts within period selected in dashboard filter usually. In such case, such verification report must have filters “re-organized” which means to delete some filters, create filter like in dashboard, and to put back report remaining filters after this copy of dashboard filter. 

When Parent filters are used in dashboard, last filtering value applied only can be put into verification report. 

If dashboard uses disconnected date dimension, it can not be used as a filter in verification report. This date dimension must be replaced by date dimension which is affected by dashboard filter. E.g., “Date (Created) BETWEEN __period_start AND __period_end)” must be replaced by “Date (Created) BETWEEN 87 days ago AND 46 days ago” - but do not forgot that this is floating filter and it must be modified when this verification filter is opened in next days, to cover the same date interval as it can be set in verified dashboard.  

Reply