Constructions are used to create new items or variable types in a project. You can create new variables using items that already exist in the project, or with user-entered values.
To create a measure, you first need to select the desired position in the project tree. From here choose new measure under construct from the design menu Learn more about the design menu. and then define the expression using the expression editor.
- You can create new measures from an existing measure, or weight, values, or by entering values explicitly into the definition.
- Measures contain a single value for each respondent.
- Records to be excluded from the measure’s count need to be assigned a NULL value.
In this article
1. Conditions and Functions
a) If statements
If statements are used to populate a new measure or weight with a different value depending on specific conditions.
If statement syntax
- The syntax for the if statement is:
if (Logic_Test, Value_if_True, Value_if_False)
- The syntax for a nested if statement is:
if (Logic_Test, Value_if_True, if (Logic_Test, Value_if_True, Value_if_False))
b) Count responses
The count function is used to define a new element or a new measure by counting the number of responses given to the items listed in a comma-separated list. The count function creates a numeric value from an existing axis, element or measure. Learn more about the Count function
Count function syntax for measures
a) Counting all responses in a standard axis.
With this syntax, the values count returns are the number of elements each respondent responded to. Note, only multiple-response variables will ever give a count greater than 1.
- Measure: count (AxisName1)
b) Count function with Boolean logic can be used to count whether a respondent mentioned at least one response to a specific set of items.
Using count ( _ or _ or _ )
With this syntax, the values count returns are 0 and 1. The maximum count the expression returns is 1.
- Measure: count (AxisName1.(ElementName1 or ElementName2 or Element 3))
Using count ( _ , _ , _ )
With this syntax, you can sum together counts from a specific set of items. It evaluates the number of items a respondent has answered and adds the count for each. The maximum count the expression returns is the max number of possible responses.
- Measure: count (AxisName1.ElementName1 , AxisName1.ElementName2 , AxisName1.ElementName3)
Let's assume you want to find out the number of devices that were used during a trip, excluding the element "None of these". In this case, the best syntax to use is count ( _ , _ , _ ). This will just take into account the elements you want to include in the calculation.
Measures can also be defined using calculations, i.e.
- Addition using +
- Subtraction using -
- Multiplication using *
- Division using /
Let's assume you want to create an "Other Costs" measure containing the amount spent that wasn’t on airfares or packages, i.e. the amount left after subtracting airfares and packages from total spend.
Where to from here?
Learn more about different construction types.