It is not uncommon for dashboards to have multiple combo box filters. In the following example, there are four of them: Gender, Senior Citizen, Partner, and Dependents.
Having a too many combo box filters can get inefficient and slow. To get around this problem, we recommend that you condense all the filters into a single filter.
For example, let's say you have 20 separate filter variables and 10 tables with those filters applied to them. Without condensing them this is how it works:
- Every separate filter has to calculate to identify the records that match the filter
- Then, as every table calculates, it has to match up each of the 20 filters together to find out exactly which respondents qualify. It has to do this separately on each table before the table can run.
- So in the end it's 20 filters to calculate, then 10 additional calculations for the tables even before the tables can run
In contrast, with a condensed filter:
- The filter runs once and identifies the right respondents
- Each table only needs to use the single filter's data to run
- So 20 filters become 1, and you also save the additional step of each table combining the 20 filters to find the right respondents
A Displayr Document with multiple combo box filters
In order to condense combo box filters into a single filter variable:
- Select Anything > Data > Variables > New > Custom Code > R - Numeric. This will add a new variable called newvariable in your Data Sets Tree. It will also create an R CODE box on the right.
- Select newvariable, and in the Object Inspector, rename the variable Name and Label to names of your choice. In this example, we will call it CombinedFilter.
- Select CombinedFilter and type the names of each of your combo box filters on separate lines in the R CODE window. Then add a line of code that adds them together. For example:
- In the Data sets tree, click on each filter variable one at a time and Copy/Paste the command in the R CODE window on the appropriate line in your R CODE window of the CombinedFilter variable.
For example, this is the code in the Gender filter variable
... and what it looks like after you copy/pasted the code into the CombinedFilter R CODE window:
- Repeat the previous step with each of your other combo box filters. After you are finished, the completed R CODE window for your condensed filter variable should look like this:
Next you need to make the new variable usable as a filter.
- In the object inspector for CombinedFilter, tick Usable as a filter under Properties > GENERAL.
Finally, you need to ensure this is the only filter in each of your outputs.
- Click each output on the page, and select Inputs > FILTERS & WEIGHT
- Uncheck each box corresponding with the original filters and select CombinedFilter as the only filter variable
How to Create a Complicated Filter
How to Create a Combo Box Filter
Reduce the Number of "Things" and the Size of the "Things" in a Document
Article is closed for comments.