Establishing Cube Context

Analysis Services

Analysis Services

Establishing Cube Context

To establish cube context, indicate the cube on which you want the Multidimensional Expressions (MDX) query to run. The FROM clause in an MDX query determines the cube context. The following syntax indicates which cube supplies the context for the MDX query:

FROM «cube_specification»

The «cube_specification» is completed with the name of a single cube.

For example, if an MDX query is to be run against the SalesCube cube, the FROM clause would be:

FROM SalesCube

This does not limit you from working with more than one cube at a time; you can use the LookupCube function to retrieve data from cubes outside the cube context. The following syntax will cause an error, because unlike SQL, the FROM clause in an MDX query does not usually permit joins:

FROM SalesCube, OtherCube

However, some OLAP providers may permit the joining of cubes along congruent dimensions; if two cubes share a dimension, the cubes can be joined using this syntax, in a fashion similar to that of linked cubes. For more information about joining cubes, see your OLAP provider documentation.

For more information about the FROM clause in the MDX SELECT statement, see SELECT Statement.