Wednesday, 20 November 2013

Parallel Period in MDX

Parallel Period Function in MDX can be used to get values for Prior Period with same relative position.

Example 1:

  • Query below gets "Order Count" for 2008 and year prior to that.
 
  •  SELECT     {
            (
                ParallelPeriod
                (
                    [Date].[Calendar].[Calendar Year]
                   , 1
                   , [Date].[Calendar].[Calendar Year].&[2008]
                )
                ,[Measures].[Order Count]
            )
            ,(
                [Date].[Calendar].[Calendar Year].&[2008]
                ,[Measures].[Order Count]
             )
            } ON 0
    FROM [Adventure Works]









Example 2:


  • Query below gets "Order Count" for Nov 2006 and Jan 2006  10 Months prior to that.
 
  •  SELECT     {
            (
                ParallelPeriod
                (
                    [Date].[Calendar].[Month]
                   , 10
                   , [Date].[Calendar].[Month].&[2006]&[11]
                )
                ,[Measures].[Order Count]
            )
            ,(
                [Date].[Calendar].[Month].&[2006]&[11]
                ,[Measures].[Order Count]
             )
            }
    ON 0
    FROM [Adventure Works]

No comments:

Post a Comment