Arithmetic Operators

Arithmetic operators are designed to perform basic mathematical operations on two or more numbers. There are 5 basic operators, with one variation for string operations.

Syntax & Usage

number 1 <operator> number 2 ....<operator> number n

or

string 1 + string 2 ....+ string n
Different Operator types
  • The operators are
    • + to ADD numbers or CONCATENATE strings
    • - to SUBTRACT numbers
    • * to MULTIPLY numbers
    • / to DIVIDE numbers
    • % to MODULUS 2 numbers and return the fractional component (supported in PQL only, not MDX)
  • The numbers used can be data points, numeric values, or model columns, depending on the calculation engine used and the context.
  • If strings are used (or mixed numbers and strings), the plus sign "+" will act to concatenate or join the values into a string result. The other operators will throw errors if used with strings.

Examples

This example adds Australian sales to Canadian Sales in the Semantic engine:

([Customer].[Country].[Australia], [measures].[sales]) + ([Customer].[Country].[Canada], [measures].[sales])

This example subtracts the values in the profit column of the data table from the sales column in the same table in the Granular engine:

[data].[sales] - [data].[profit]

This example multiplies 123 by 10 and then deducts 56 in the Common engine:

(123 * 10) - 56

This example takes the values in the expenses column and finds the modulus (remainder) for a division by 10:

[data].[expenses] % 10

This example builds a string of the first and last names of customer - with a space - in the Granular engine:

[firstname] + " " + [lastname]