In this article
This worked example describes step-by-step how to build an advanced filter. This example in based on a fictitious survey that is intended to discover people's requirements and attitudes when buying a new car. The filter is based on two single questions (in this case Gender and Age), one multi question (Cars Text-Driven) and one grid question (Qualities I).
Note: The survey/panel must be launched before you can create the filter expression.
Assume we wish to define a filter such that we can call out the data as follows:
Male respondents under 51 who have test-driven either BMW or Chrysler, and on the second level, who are interested in Price and Safety (have answered 4 or 5 to those questions).
Create the filter as follows:
- Enter the survey for which you wish to create the filter.
- Go to the Survey Data > Edit menu command, then click the Advanced Filter button in the filter window.
- Drag the Gender, Age and Cars Test-Driven questions from the Survey tree and drop them into the AND folder in the filter - .
- Click on the first element (in this case gender)to activate the Expression Builder, then click the ellipses button beside the Value field.
- In the Available Items column on the left, select the Male option (we are looking for male respondents), then click the >> button to move Male over to the Selected Items column.
- Click OK.
- Click on the age element to activate the Expression Builder for that question, then click the ellipses button beside the Value field.
- We are looking for males under the age of 51, so select the first three options and click the >> button to move them over to the Selected items column.
- Click OK to close the window.
- Click on the carsTested element to activate the Expression Builder for that question.
- Click the down arrow beside the Operator field and select OR from the drop-down list then click the ellipses button beside the Value field.
- We are looking for people who have test-driven BMW or Chrysler, so in the Available Items column select 3 and 6 then click the >> button.
- Click OK to close the window.
The Advanced Filter Designer window opens - . Here you can define simple and complex filters that you can apply to the topline report. The same functionality is also used in Edit Survey Data and in Sampling for Panels.
Figure 1 - The Advanced Filter Designer window
Figure 2 - The three questions in the filter
Note: To insert the first element into the folder, point at the folder icon when releasing the mouse button. Subsequent elements can be positioned before or after the first within the folder by dropping them when the dotted line is in the desired position.
You must now specify the desired values for the questions.
Note that for single questions the operator will always be IN, and for multi questions the operators will be AND or OR.
The Select Answers window opens - .
Figure 3 - The Select Answers window for the Gender element
The Select Answers window closes and the code IN 1 appears after Gender in the filter - .
Figure 4 - The Gender element with Male (code 1) specified
Again the Select Answers window opens, this time with the Age options listed in the Available Items column - .
Figure 5 - The Select Answers window for the Age element
The filter will look as shown below.
The Age element with codes 1, 2 and 3 selected
The Operator options change to AND and OR. Here in this case we need OR.
The Select Answers window opens - .
Figure 6 - The Select Answers window for the carsTested element
All three questions in the filter are linked together using the AND operator. The two elements in carsTested are linked together using OR.
We now need to add in the second part of the filter.
- In the Advanced Filter Designer window, drag the OR folder from Components and drop it inside the filter. Drop it on the text of the last element to insert it into the AND folder.
- Drag the Price and Safety elements from the Qualities I grid question in the Survey and drop them into the OR folder.
- Click on the qual1_2 element to activate the Expression Builder for that element, click the ellipses button to open the Select Answers window, and select the required answers (codes 4 and 5).
- Repeat for the qual1_4 element.
Note that you cannot drag the entire grid question into the filter. You must expand the question in the Survey by clicking on its icon, then drag the elements individually. The result should be as shown below.
Figure 7 - The filter with the qual1 elements
The result should be as shown below.
Figure 8 - The final filter expression
The filter is now complete. Click OK to close the Advanced Filter Designer window.