Skip to main content

MDX Functions

This table lists all existing MDX functions and details their support level in Atoti. The following notations are used:

Functions Deviating from MDX Standards

Aggregate Function

The aggregate function in Atoti behaves mostly as described in the MSDN Aggregate (MDX) article. The differences are:

Signature with Numeric Expression as Second Argument not Supported

The signature with a numeric expression as second argument is not supported:
  • Aggregate(<Set Expression>) is supported
  • Aggregate(<Set Expression>, <Numeric Expression>) is not supported

Sets with Dimensionality 1

The aggregate function can only operate on sets with dimensionality 1.

Double Counting is Discarded

Double counting is discarded. For example, if you have a Geography dimension with the following members:
and you ask for: Aggregate({[Geography].[ALL].[AllMember].[France].[Paris], [Geography].[ALL].[AllMember].[France].[Paris]}) , then Paris is only counted once.

Isolated Calculated Member

An aggregate can only be used as an isolated calculated member. It means
would not work and needs to be rewritten as

Caption Function

This function returns the formatted name of a member. It is also the value of the Intrinsic Member Property MEMBER_CAPTION. See MSDN Intrinsic Member Properties (MDX).

Syntax:

InStr Function

This function looks for a string within another. It returns the index (one based) at which the sub-string starts, zero if it is not found. The lookup is case-insensitive. It is possible to specify an offset (one based) at which the search should start. See MSDN InStr Function (VBA).

Syntax

  • offset (optional): The offset at which the lookup should start in the value. This offset is one based. If the offset is not an integer, an error is returned. If the offset is less or equal to zero, an error is returned.
  • value: The string to look into.
  • lookup: The string to look up.

Examples

Left Function

This function returns the sub-string of a string starting from the first character up to a specific input length.

Syntax

  • value: The string to sub-string.
  • length: The length of the sub-string. If the length is not an integer, an error is returned. If the length is lower than zero, an error is returned.

Examples

Member Caption Function

The ‘member_caption Function’ is an alias for the ‘Caption Function’. See Caption Function (MDX)

Order Function

The MDX Order function in Atoti behaves mostly as described in the MSDN Order (MDX) documentation. This section provides additional details that are not mentioned in the MSDN page.

Nested Calls to Order and Hierarchize - Stable Sort

Calling Order(Hierarchize(set_expression)) deactivates the Hierarchize order. Calling Hierarchize(Order(set_expression)) deactivates the Order order. Calling Order(Order(set_expression)) performs a stable sort. This means that members that are equal according to the first (outer) ordering are sorted according to the second (inner) ordering. This functionality doesn’t work if any function is inserted between the calls to ‘Order’. For example, Order(Filter(Order(set_expression))) doesn’t perform a stable sort. Results are sorted only according to the first (outer) ordering.

Examples

Right Function

It returns the sub-string of a string starting from the last character going backwards to a specific input length.

Syntax

  • value: The string to sub-string.
  • length: The length of the sub-string. If the length is not an integer, an error is returned. If the length is lower than zero, an error is returned.

Examples

VisualTotals Function

The behavior of this function is slightly different from the standard (see MSDN). When you use VisualTotals on a dimension, only the members that appear in the given set and are not measures will be granted (see ISubCubeProperties in Standard Context Values). As a result, members not contained in the VisualTotals are excluded from the results.

Syntax

  • set: The string to sub-string.
  • pattern: Not supported.

Examples

Assuming we have the following data: The two queries below return the same pivot table:
Result:

Custom Functions

Atoti also allows the use of several non-standard functions.

Is_DataMember

This function returns ‘true’ if the given member is a datamember, ‘false’ otherwise.

Syntax

Is_UnknownMember

It returns true if the given member is an unknown member, false otherwise. A member is considered unknown either if it is the UnknownMember of its parent or if it has an UnknownMember in its path. For example, the member [dimension].[hierarchy].[level].[N/A].[A child].[A grand child] is considered unknown because it has N/A in its path.

Syntax

ActiveMeasure

For details, see Active Measures and MDX compilation.

Today

This function returns the date of the current day.

Syntax

ReverseHierarchize

ReverseHierarchize reorders a set so that its elements appear in reverse hierarchical order. The reverse hierarchical order is defined as follows: for each hierarchy in the set, elements are ordered such that
  • Parents appear before their children
  • Among siblings, the ordering is reversed: items that appear later in the hierarchy come first
You may optionally provide a level. When a level is specified, only elements at that level are reversed and the other levels in all other hierarchies are sorted in ascending hierarchical order. If a level is specified, but elements of the given Set do not express a coordinate on that level, this function behaves like Hierarchize.

Example

Given the following set: Applying ReverseHierarchize to the full set produces: If the level argument is set to Level 1 of Hierarchy 2 (A, B, and C), the result is:

Syntax