Using custom dimensions and profile filters

Sometimes a requirement goes beyond what Q_Panel dimensions and filters provides. For these circumstances Q_Panel comes with its own Expression Builder which can be used to build custom profile filters and dimensions.

We recommend that you spend time analysing your requirement before starting to define it in the Expression Builder.

The Expression Builder allows dimensions and filters to be created from Expressions and Expression Groups:

Expressions A filter variable with one or many conditions e.g. Gender = male, or SundayNewspapersRead = ‘Sunday Times’ or ‘Sunday Telegraph’
Expression Groups () One or more Expressions enclosed in parentheses.

An Expression Group has a property Operator which can be set to AND (default) or OR. This determines the operator used across the Expressions in an Expression Group.

Example - Custom Profile Filter

Filter on all panellists over retirement age. 

(This requires a custom filter because retirement ages differ between males and females in the UK i.e. for males it is 65 and for females 60.

For this example we need to specify a condition for male panellists over retirement age:

Gender = male and Age = 65-

or female panellists over retirement age:

Gender = female and Age = 60-

These Gender/Age combinations naturally form two Expression Groups each consisting of two Expressions with Operator = AND:

()AND ∑Gender=male
∑Age=65-
()AND ∑Gender=female
∑Age=60-

The two Expression Groups now need to be logical-OR’d together because we want to select either males over 60 or females over 65.  To do this we define a ‘parent’ Expression Group which includes both ‘child’ Expression Groups with Operator = OR:

(( Gender=male AND Age=65-) OR (Gender=female AND Age=60-))

that is:

()OR ()AND ∑Gender=male
∑Age=65-
()AND ∑Gender=female
∑Age=60-

To define our example in a profile filter using the Q_Panel Expression Builder:

  • in the Filters tab of a Sample Project click the Add button. In the Add Filter dialog set the Filter Type to Profile and click OK.
  • For Element 1 click +Custom to bring up the New Custom Filter (Expression Builder) dialog

The buttons on the toolbar have the following meanings:

The top-level Expression Group parent is automatically created and defaulted to ‘AND’ its child expressions.

For our example the top-level Expression Group requires Operator = OR.

  • To change it click on (highlight) the parent () ‘AND’ child expressions. In the toolbar click the Edit ExpressionGroup button to get the Expression Group dialog where you can select the OR option for Operator:

  • Click on OK. 

The top-level now reads ‘OR’ child expressions.

Note that Custom Filters also support a logical ‘NOT’ when defining an Expression Group  - the ‘Negate expression group’ option.

In our example we now need to create a child Expression Group with Operator = AND.

  • Click the Add ExpressionGroup toolbar button and click OK to accept the default Operator AND:

Now we are ready to construct the first child Expression.

  • Click on () ‘AND’ child expressions to select it then click the Add Expression toolbar button to open the Expression Builder dialog.
  • Open up the Main Profiler folder and select Gender. Tick the box for ‘Male’:

Note that Custom Filters and Dimensions also support a logical ‘NOT’ when defining an Expression (‘Match all <variable name> NOT specified’ option).

As well as selecting variables from the Profiler Variables folders, you may also create custom filters using variables from the Profilers folder, External File folder (if an external file is being used for the sample) or Lookups folder.

  • Click OK to get:

The box below the Expression area shows you how the filter is taking shape.

  • Click the Add Expression toolbar button again, this time select Age and set it to ’65-‘ to get:

The first Expression Group is complete.

Now repeat the exercise to construct the remaining Expression Group.

  • Select the top-level ‘OR’ Group, click Add ExpressionGroup and then OK.
  • Select the new Expression Group and click Add Expression.
  • Select Main Profiler, Gender and select Female. Click Add Expression again, select Main Profiler, Age and type in ’60-‘.

The completed filter looks like this:

Give the custom filter a description and click the Save button to save it to your sample project.  Remember that you must Save your sample project if you want to keep the new filter.

You can make your filters and dimensions as complex as you wish and have as many as you wish bearing in mind what is realistic.

You may want use the Save As button to save this custom filter for use in later prototypes or samples.

No Value Filter options

When defining an Expression it is possible to allow for NULLs (no value) by using the No Value Filter options which appear in the Expression Builder dialog.

Option Description
All Except records with no value Include all panellists in the database except those with a NULL value. Ignore the specified values (they are greyed out).
Exclude records with no value (default) Include all panellists in the database with the values specified, and exclude panellists with a NULL value.
Include records with no value Include all panellists with the values specified, and those with a NULL value.
Only records with no value Include only panellists with a NULL value. Ignore the specified values (they are greyed out).

Example - Custom Dimension

We wish to have a 30% / 70% split between retirement age panellists and working age panellists in our sample project.

  • On the sample project parameters tab under Dimensions click the Add Custom button.

A new dimension will be added with the default name ‘Custom’, this can be changed by clicking on it and entering a new name. 

Click on + Element to open the Custom Dimension (Expression Builder) dialog.

Construct the Over retirement age condition as described in the previous Custom profile filters section:

The only difference from a Custom Filter is that we now set a Target % for the dimension of 30%.

Save this and construct the other custom element for the 70% of working age which is:

Save this and your dimension is now complete.

You may want use the Save As button to save this custom dimension as a named dimension for use in later prototypes or samples.

As well as selecting a variables from the Profiler Variables folders, you may also create custom filters using variables from the External File folder (if an external file is being used for the sample) or Lookups folder.