Arithmetic Operators (MDX)
Arithmetic operators perform basic math operations on their operands. AtScale supports arithmetic operators in Calculated Measure formulas. Notice the NULL handling behavior in MDX is different than SQL.
Operator | Description | Examples |
---|---|---|
+ | Addition String Concatenation | 1 + 2 = 3 1 + NULL = 1 'Name' + 1 = Name1 'Hello' + 'World' = 'Hello World' [Measures].[sale_amount] + [Measures].[tax] Also see SQLSUM. |
- | Subtraction | 2 - 1 = 1 2 - NULL = 2 [Measures].[sale_amount] - [Measures].[discount] |
* | Multiplication | 2 * 2 = 4 2 * NULL = NULL [Measures].[sale_amount] * .085 |
/ | Division | 4 / 2 = 2 4 / 0 = undefined 4 / NULL = NULL NULL / 2 = NULL [Measures].[bytes] / 1048576 |
^ | Power | 2 ^ 3 = 8 area = 3.14 * r ^ 2 [Measures].[bytes] ^ 2 |
can return NULL or an error depending on the SQL engine