Documentation Index
Fetch the complete documentation index at: https://docs.activeviam.com/llms.txt
Use this file to discover all available pages before exploring further.
Introduction
In the MDX language, filtering can be achieved either by specifying a Slicer axis (using the WHERE clause) or by using a Subselect expression (nested SELECT statements). This affects the originating query, either by generatingCubeFilters or by rewriting the initial query location so as to express the initial MDX filtering.
MDX Filtering
Slicer Axis
The Slicer axis filters the data returned by the MDX SELECT statement, restricting the returned data so that only data intersecting with the specified members will be returned. It can be thought of as an invisible extra axis in a query. The slicer axis is defined in the WHERE clause of the SELECT statement.Important: Unlike the WHERE clause in SQL, the WHERE clause of an MDX SELECT statement never directly filters what is returned on the Rows axis of a query. To filter what appears on the Rows or Columns axis of a query, you can use a variety of MDX functions, for exampleFilter(),NonEmpty(), andTopCount().
Impact of Slicer on Query Location
In Atoti, filtering expressed through the Slicer axis may be reflected directly in the locations evaluated at query time. Expressing a Slicer axis with a single tuple expression instead of a set, will result in the rewrite of the query so that the query location includes the tuple’s members. Any other slicer expression that does not fall into this case will be translated to a Subselect expression.Subselect Expression
Subselect expressions are nested SELECT expressions used to restrict the view of the cube from where the outer external SELECT is being evaluated. They define a new space over which all calculations are evaluated. In other words, Subselects allow you to run a query as if a hierarchy only contained a subset of its members. Internally, the evaluation of a Subselect will result in the creation ofCubeFilters characterizing the new space.
Subselects can be nested without limited depth, except available memory. The innermost Subselect defines the starting subspace over
which filtering is applied and passed onto the next outer SELECT. An important thing to note is that nesting is not a commutative operation:
the order in which the nesting is done may produce different results.
This particularity implies that the performance of expensive operations in the main query can be improved using Subselects
to reduce the amount of data the main query has to deal with upfront.
Do not confuse filtering using the Slicer axis or a Subselect statement, and filtering using MDX functions. The former changes the values appearing in the result whereas the latter only controls what appears on rows and columns by filtering the sets displayed there. There are many functions specialized for filtering such asFilter(),NonEmpty(),TopCount()or even theNON EMPTYstatement.
MDX Default Members
The default member of a hierarchy is used to evaluate expressions when a hierarchy is not included in a query. Otherwise, whenever a hierarchy from a dimension is included in a query, all the default members in the hierarchy are ignored. This may produce counter-intuitive results, especially when using filtering. The evaluation of the default member follows the following rules:- If the hierarchy on which the default member is defined is present on any axis, the default member is ignored (by definition).
- If granted, the default member of a hierarchy acts as a default slicer when the given hierarchy is not explicitly included in a query axis (by definition).
- When using a Subselect:
- If the sub-selected set includes the hierarchy’s default member, then if the corresponding hierarchy is not present in the top-level select, the MDX engine forces the evaluation on the default member for the hierarchy. This will result in an aggregation on the corresponding default member (the default member cannot be applied on the top level because the hierarchy is already present).
- If the default member is not in the Subselect, then the evaluation is either on AllMember or another given member for a slicing hierarchy.
- In other words, defining a filter on hierarchy members using a Subselect has no visible effect unless It excludes the MDX default member of that hierarchy or if the hierarchy is expressed on any axis of the top-selection.
Definition
For each hierarchy, it is possible to define a collection of default member candidates in the MDX context as illustrated below:- If both EUR and USD are granted, the MDX engine uses EUR as the default member.
- If the subcube properties exclude the EUR member, the MDX engine uses the USD member as the default member.
- If both EUR and USD are excluded, the MDX engine will not use any mdx default member. In this case, the default member would be AllMember.
For a slicer hierarchy that does not contain the ALL level, the default member is the member selected by default as the filter
for that hierarchy.
The MDX context can be set through query context values at query time as illustrated below:

You can also specify the DefaultMember property for a security role when building the IEntitlementsProvider.
Examples
Let us consider the following example with the hierarchies[Booking].[Desk] and [Currency].[Currency]
where the default member on the Currency hierarchy is EUR.
By definition, when the Currency hierarchy is expressed on any axis (ROWS, COLUMNS, or WHERE), the default member is not taken
into account. For instance the following query



Hiding the Currency Hierarchy
Removing the Currency hierarchy from the query will force the evaluation on the default member EUR. This is equivalent to executing the following query:
Multiple Selections (Subselect)
When an MDX query involves a Subselect, the MDX engine first evaluates the Subselection, then applies some filters to the cube based on the results of this Subselection before finally evaluating the top SELECT. For instance, consider the following query:
Subselect Granting a Default Member
The following query includes a Subselect granting EUR, CHF, GBP, JPY, and USD.
- According to the Subselect, EUR is granted.
- However, the Currency hierarchy is not present on any axis of the top-level SELECT.

Subselect Excluding Default Members
The following query grants CHF, ZAR, GBP, JPY, USD.