Wednesday, 21 December 2016

MDX -- SET and TUPLE-- Part-4

                              MDX -- SET and TUPLE-- Part-4

What is SET:-
                                                    Set is collection of Items/Members from same
 Hierarchy.
 
/*   SET AND TUPLE      */
-- SET
-- SET is a collection of Items/Members from the Same Hierarchy
-- SET should be enclosed with FLOWER BRACKET {}

-- Example-1
SELECT [Measures].[Sales Amount] ON COLUMNS
      ,[Dim Customer].[English Country Region Name].[English Country Region Name]
       ON ROWS
FROM [MSBI]

-- Example-2
SELECT {
         [Measures].[Sales Amount]
        ,[Measures].[Order Quantity]
        ,[Measures].[Tax Amt]
       } ON COLUMNS
      ,[Dim Customer].[English Country Region Name].[English Country Region Name]
          ON ROWS
FROM [MSBI]

-- Example-3
SELECT  [Measures].[Sales Amount]
           ON COLUMNS
      ,{
         [Dim Customer].[Geography Hierarchy].[English Country Region Name]
        ,[Dim Customer].[Geography Hierarchy].[State Province Name]
        ,[Dim Customer].[Geography Hierarchy].[City]
       } ON ROWS
FROM [MSBI]





What is TUPLE:-
                                                    Tuple is collection of Items/Members from different  Hierarchy.
-- TUPLE
-- TUPLE is a collection of Items/Members from Different Hierarchy
-- TUPLE should be enclosed with SQUARE BRACKET ()

-- Example-1
SELECT [Measures].[Sales Amount]
           ON COLUMNS
      ,(
         [Dim Customer].[English Country Region Name].[English Country Region Name]
        ,[Dim Customer].[State Province Name].[State Province Name]
       ) ON ROWS
FROM [MSBI]

-- Example-2
SELECT [Measures].[Sales Amount] ON COLUMNS
      ,(
         [Dim Customer].[English Country Region Name].[English Country Region Name]
        ,[Dim Customer].[State Province Name].[State Province Name]
        ,[Dim Customer].[City].[City]
       ) ON ROWS
FROM [MSBI]

-- Example-3
SELECT (
        [Order Date].[Calendar Year].[Calendar Year]
       ,[Measures].[Sales Amount]
       )
        ON COLUMNS
      ,(
         [Dim Customer].[English Country Region Name].[English Country Region Name]
        ,[Dim Customer].[State Province Name].[State Province Name]
        ,[Dim Customer].[City].[City]
       ) ON ROWS
FROM [MSBI]
 


 

 

 

 
 
 

 


No comments:

Post a Comment