Operators in calculated fields
When editing custom reports you can use operators in calculated fields and measures.
Operators get evaluated in the order outlined in this table.
Operator | Syntax | Description |
|---|---|---|
multiply, divide | i*j/k | Arithmetic operators for numeric types only. |
percent | i%j | Calculates i as a percent of j; numeric types only. |
add, subtract | i+j-k | Arithmetic operators for numeric types only. |
equal | i==j | Comparison operators for string, numeric, and date types. |
ot equal
| i!=j | Comparison operators for string, numeric, and date types. |
less than | i<j | Comparison operators for numeric and date types only. |
less than or equal to | i<=j | Comparison operators for numeric and date types only. |
greater than | i>j | Comparison operators for numeric and date types only. |
greater than or equal to | i>=j | Comparison operators for numeric and date types only. |
IN set | i IN ('apples','oranges') | Sets can be of any type. |
IN range | i IN(j:k) | Ranges must be numeric or date types. |
NOT | NOT(i) | Boolean operators; parentheses are required for NOT. |
AND | i AND j AND k | Boolean operators; parentheses are required for NOT. |
OR | i OR j OR k | Boolean operators; parentheses are required for NOT. |
parentheses | () | Used for grouping operators. |
note
- Thesereserved wordscan't be used as field or measure names: AND, And, and, IN, In, in, NOT, Not, not, OR, Or, or. However, a reserved word can be used in a field or measure name if it's contained within a string, such as "Not Available."
- Whendatesget used in comparisons or IF functions, they must be of the same type (date only, date/time, or time only). Make sure to use the correct modifier (d, ts, t) when using date constants in comparisons.