MDX misunderstanding: complex FROM clause

Posted on

Question :

I have a MDX query which syntax is familiar to me:

SELECT NON EMPTY { [Measures].[Amount] } ON COLUMNS, 
       NON EMPTY { ([Projects].[Id].[Id].ALLMEMBERS * [Priorities].[Id].[Id].ALLMEMBERS ) }     
FROM [Reports]         
WHERE [CreatedOn].[Date].&[2010-01-01T00:00:00]:[CreatedOn].[Date].&[2010-02-01T00:00:00]

But I can rewrite the query such way:

SELECT NON EMPTY { [Measures].[Amount] } ON COLUMNS, 
NON EMPTY { ([Projects].[Id].[Id].ALLMEMBERS * [Priorities].[Id].[Id].ALLMEMBERS ) } ON ROWS 
FROM (SELECT [CreatedOn].[Date].&[2010-01-01T00:00:00]:[CreatedOn].[Date].&[2010-02-01T00:00:00] ON COLUMNS
FROM [Reports])

New query returns the same results, but FROM section looks obscure to me. How query can have two FROM section? Where can I find information about this syntax?

Answer :

Recent versions of SSAS (IIRC 2008+) support subqueries in MDX in much the same way that SQL does. What you see here is a subquery being used to produce a subcube that is then queried by the outer query. There’s an article on it here.

Leave a Reply

Your email address will not be published. Required fields are marked *