MDX to get the dimensions of a cube?

Suppose a named cube MyCube

has 2 dimensions and I want to build an MDX statement SELECT

without knowing the dimension name, but I have a list of items with one item from each dimension:

SELECT [ELEM X from first dimension] ON 0,  [ELEM Y from second dimension] ON 1
FROM [MyCube]

      

Alternatively, is there a function that will return a list of all dimensions and what can I use to build my MDX?

+3


source to share


1 answer


Yes, you can request a measurement without knowing its exact name. You don't even have to know the names of any member, as this example shows. Just be careful if you get a grid of 10,000 x 10,000 results!

SELECT 
{Dimensions(0).Levels(0).members} ON ROWS, 
{Dimensions(1).Levels(0).members} ON COLUMNS 
FROM [Sales]

      



It can also be useful to use .members(0)

or [Measures].allMembers

to indicate elements whose names are unknown.

+1


source







All Articles