Comparison Operators

Comparison operators are designed to perform comparative operations between 2 expressions, resolving to true or false values.

Syntax & Usage

expression 1 <operator> expression 2
Different Operator types
  • The operators are
    • > for GREATER than comparisons
    • >= for GREATER than or EQUAL to comparisons
    • < for LESS than comparisons
    • <= for LESS than or EQUAL to comparisons
    • = for EQUAL to comparisons
    • != for NOT EQUAL to comparisons (in MDX its "<>")
  • The expressions used can be data points, numeric values, or model columns, depending on the calculation engine used and the context.

Examples

This example compares Australian sales to Canadian Sales in the Semantic engine. If Australian sales are greater, then the result is TRUE:

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

This example compares the values in the profit column of the data table to the sales column in the same table in the Granular engine. If sales are greater or equal, the result is TRUE:

[sales] >= [profit]

This example checks if the aggregate expenses for all items in product categories is NOT EQUAL to 56,000 in the Semantic engine:

Aggregate({AllMembers([products].[Product Category])},([measures].[data Expenses])) != 56000

This example checks if 511 modulus 10 is equal to 10 (all engines):

511%10 = 10

This example checks if the cost of blade products is less than or equal to 100,000 AND if sales are greater than 20,000 in the Semantic engine:

([Product].[Product].[Blade], [measures].[cost]) <= 100000 && [measures].[sales] > 20000