Filter Best Practice

Filters can be very useful in model building and are widely used, but they can come at the expense of performance—often very visible to users through their use on dashboards.

Performance can also hit imports and exports, which in turn may lead to the blocking of other activity, causing a poor perception of the model.

There are some very simple guidelines to design well-performing filters:

Using a Single Boolean Filter on a Line Item That Does Not Have Time or Versions Applied and Does Not Have a Summary Is Fastest

Try to create a Boolean line item that incorporates all the filter criteria you want to apply. This allows you to re-use the line item and combine a series of Boolean line items into a single Boolean for use in the filter.
For example, you may want to filter on three data points: Volume, Product Category, and Active Status. Volume is numeric, Product Category is a list formatted line item matching a user selection, and Active Status is a Boolean.

Create a line item called Filter with the following formula:
Volume > Min Vol AND Product Cat = User Selection.Category AND Active Status
Here’s a very simple example module to demonstrate this:

Product Volumes.pngA Filter line item is added to represent all the filters we need on the view. Only the Filter line needs to be dimensioned by Users.
A User Selection module dimension only by Users is created to capture user-specific filter choices:

user selection.pngHere’s the data before we apply the filter:filter off.png Here's the data with the filter applied:
filter on.png

A best practice suggestion would be to create a filter module and line items for each filter part. You may want other filters and you can then combine each filter as needed from this system module. This should reduce repetition and give you control over the filters to ensure they can all be Boolean.

What Can Make a Filter Slow?

The Biggest Performance Hit for Filters Is When Nesting Dimensions on Rows.
The performance loss is significantly increased by the number of nested dimensions and the number of levels they contain. With a flat list versus nested dimensions (filtering on the same number of items) the nested filter will be slower. This was tested with a 10,000,000 list versus 2 lists of 10 and 1,000,000 items as nested rows; the nested dimension filter was 40% slower.

Filtering on Line Items With a Line Item Summary Will Be Slow.

A numeric filter on 10,000,000 items can take less than a second, but with a summary will take at least five seconds.

Multiple Filters Will Increase Time.

This is especially significant if any of the preceding filters do not lower the load because they will take additional time to evaluate. If you do use multiple filter conditions, try to order them so the most effective filters are first. If a filter doesn’t often match on anything, evaluate whether it's even needed.

Hidden Levels Act as a Filter.

If you hide levels on a composite list, this acts like a filter before any other filter is applied. The hiding does take time to process and will impact more depending on the number of levels and the size of the list.

Avoid Nested Rows for Export Views

Using nested rows can be a useful way to filter a complex set of data for export, but, as discussed above, the filter performance here can be poor.

The best way around this is to pivot the dimensions so there is only one dimension on rows and use the Tabular Multi Column export option with a Filter Row based on Boolean option.
tabular export.pngSome extra filter tips include the following: 

  • Filter duration will affect saved views used in imports, so check the saved view open time to see the impact. This view open time will be on every use of the view, including imports or exports.
  • If you need to filter on a specific list, create a subset of those items and create a new module dimensioned by the subset to view that data.
The content in this article has not been evaluated for all Anaplan implementations and may not be recommended for your specific situation.
Please consult your internal administrators prior to applying any of the ideas or steps in this article.
Comments

I just advised a customer on Nested Rows in an export today... They had an abnormally large module with 4 List items in the column of the saved view. The saved view was taking exponentionally more time to load vs a default view with one list item in the row. They adjusted their view, sped up the load time, and adjusted their export.

This is fantastic information! I have used the techniques here to improve performance on filters signficantly. In one case, I was able to reduce the load time for a saved view from over 2 minutes down to 2 seconds.

Contributors
Labels (2)