Previous topic

Next topic

Edit calculated group

A Calculated group is formed by applying a user-provided formula to the values of the group members.

To create or edit a calculated group:

  1. On the Edit calculated group page, provide a label for the group (or accept the default label).
  2. Decide which values you want to use in your formula. You can use Search to help you locate the items you want to use.

    Show all and Show selected enable you to view either all the available items or only the items you have selected. This can help you visualize your item selections more clearly.

  3. Enter a formula you want to use to define the group's value. For example, to average values for the items Canada and the United States, you would enter the following formula:
    ([CAN] + [USA])/2
  4. Click Save.

    The calculated group appears on the Custom groups page.

Formulas for calculated groups

Note: Formulas for calculated groups have a 255-character limit.

Use the following arithmetic operators:

+  Add
-  Subtract
*  Multiply
/  Divide
 Raise to the power of

Use the following relational operators:

<  Less than
<=  Less than or equal to
=  Equal to
>  Greater than
>=  Greater than or equal to
<>  Not equal to

Evaluate from left to right, except for the following exceptions:

Use logical constructs:

If, then, else, and endif constructs can be used to create more complex formulas.

Missing values in calculations

Formula examples

Formula

Result

Salary*1.1

Salary multiplied by 1.1

(Age+20)/2

(Age plus 20) divided by 2

if Age >40 then Salary*1.05 else Salary*1.15 endif

If Age is greater than 40, then Salary is multiplied by 1.05; if Age is less than or equal to 40, Salary is multiplied by 1.15

if Sex = “1” then 0
else Salary*1.1 endif

If Sex = code 1, the value is zero; otherwise Salary is multiplied by 1.1 to arrive at the value.

if Population > 10000 then Expenditure / Population else {} endif

If Population is greater than 10000, Expenditure is divided by Population. Otherwise the result is a missing value.