This article describes how to take one question and filter it by the categories in another question, either by 1) adjusting the sample size of the original variables, or 2) creating new variables using each of the original variables split out by the categories of another variable set. More specifically:
- The original question structure is retained, and each variable's base is changed based on another question. One example may occur when variable(s) represent a brand and you wish to filter each by respondents who use that brand. When the filter condition is satisfied, the new variable(s) will take the same value as the old variable. When the filter condition is not satisfied, the new variable will be assigned a missing value. This removes the respondents who do not satisfy the filter from the base.
- A grid-type or multi type question is created where multiple variables are created with the combinations of each category from each question, filtered by the corresponding filter category. This is useful when you want to "flatten" a crosstab or add a third variable set to your table without creating a banner. This is also useful when you want to create a multiway (pivot) table for a particular metric/numeric variable.
Requirements
- A variable or variable set to filter. This can be any variable or variable set in your document.
- A Nominal or a Binary - Multi variable set to use as a filter.
Method 1 - Retain the original structure and update Base n= based on another question
This method is illustrated above and is useful when a variable set represents brands and you want to filter each brand by the respondents who use that brand, for example:
Go from a Binary - Grid question in which all columns are based on the total sample...
....to a table in which each column (e.g., retailer) is rebased using another question (e.g., visited the retailer in the last 12 months).
- From Data Sources, select the variable set you wish to filter.
- Hover and click + > Filter > Filter One Variable Set by Another.
- In the first dialog box, ensure the variable set you want to filter is selected, then press OK.
- In the second dialog box, select the variable or variable set to use as a filter, then press OK.
- If prompted to split by each category, click Yes.
- If prompted, match the appropriate items based on the prompt and click OK. Repeat as necessary.
- Displayr will generate a new version of your question with the correct base n= using the appropriate question label.
Method 2 - Create a filtered variable broken out by categories
A grid-type or "multi" question is created where multiple variables are created with the combinations of each category from each question, filtered by the corresponding filter category. This is useful when you want to "flatten" a crosstab or add a third variable set to your table without creating a banner. This is also useful when you want to create a multiway (pivot) table for a particular metric/numeric variable. For example, I will filter a 'likelihood to recommend' numeric variable by Age to see the NPS score for each age group:
Which can then be crosstabbed by another variable to see the breakout, for example, by campsite:
- In the Data Sources tree, select the variable set that you want to filter.
- Hover and click + > Filter > Filter One Variable Set by Another.
- In the first dialog, ensure that the variable to be filtered is selected and click OK.
- In the second dialog, select the variable that you want to use to filter and click OK.
- If prompted to split by each category, click Yes.
- If prompted, match the appropriate items based on the prompt and click OK. Repeat as necessary.
- A new variable will be created in the Data Sources tree and can be used in further analysis.