A calculated expression uses numerical values to perform calculations based on values stored in other variables. Creators and Explorers can create new measures using calculations defined in the expression editor, which allows users to explore deeper into the data.
In this article
1. Arithmetic Calculations
Arithmetic calculations need to be associated with a numerical value. This value can come from a measure or can be defined using the count function.
Calculations in Harmoni include:
- Addition using +
- Subtraction using -
- Multiplication using *
- Division using /
Example
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.
- Add the new measure
- In the expression editor, define the new measure using the minus symbol
- You can type or select it from the drop-down list
- Apply the expression
2. Comparative Operators
Comparative operators are used with numerical values. This value can come from a measure or be defined using the count function.
Comparative operators include:
- Greater than >
- Less than <
- Less or equal <=
- Greater or equal >=
- Not equal <>
- Equal =
Example
Let's assume you want to create a new "Target Segments" axis with the following element:
- Frequent Flyer Retirees = 65+ years who visited the moon more than twice
Here you have a combination of a standard axis and a measure. Given that you have a measure, you need to use a comparative operator to be associated with a numerical value, in this case, more than two visits.
AxisName1.(ElementName1 or ElementName2 or ElementName3) and MeasureName1 > value
- Add the new axis and element
- In the expression editor,
- You can type or select it from the drop-down list
- Apply the expression
Where to from here?
Learn more about Constructions: