Showing posts with label Brackets. Show all posts
Showing posts with label Brackets. Show all posts

Monday, July 28, 2014

More dimensions on rows

Let’s add a second dimension to our query:

SELECT
    {
     [Measures].[Sales Amount]   
    } ON COLUMNS
    ,   
    NON EMPTY
    {
      [Date].[Calendar Year].Children
    , [Product].[Product Model Lines].Children
    }                    
    ON ROWS
FROM
    [Adventure Works]

Hmmmm, we get an error:

“Members, tuples or sets must use the same hierarchies in the  function.”

More Measure Columns

Adding more measure columns is simple, but you have to be aware of the extra Curly Brackets “{ }” which enclose your row or columns definition. Let’s try:
SELECT
    {
     [Measures].[Sales Amount]
    ,[Measures].[Tax Amount]
    ,[Measures].[Total Product Cost]    
    } ON COLUMNS
    ,   
    NON EMPTY
    {
    [Date].[Calendar Year].Children
    }                    
    ON ROWS
FROM
    [Adventure Works]