Search code examples
sql-serversql-server-2012ssasmdx

ON COLUMNS compared to ON ROWS


Why in MDX is it ok to do the following:

SELECT
[MyDim].[MyHier].[MyLevel] ON COLUMNS
FROM [CubeName]

But not the following:

SELECT
[MyDim].[MyHier].[MyLevel] ON ROWS
FROM [CubeName]

Solution

  • I've never find any good reason for that ;-) on columns, on rows are defining the 'shape' of the result (the tuples being exactly the same) and it has been decided that on columns only is ok but not on rows only; i.e.:

    a | b | c
    1 | 2 | 3
    

    but not:

    a | 1 
    b | 2
    c | 3
    

    weird as I see no problem to return those values from an MDX server implementation point of view. By the way, no columns and no rows is valid :

    select from [cube]