Tuesday, 19 November 2013

Getting MTD Values in MDX

"MonthTo Date" means aggreatated value of a particular measure from begining date to specified date.


Example 1:

  • Query below return the sum of "Order Quanity" from 1st August 2007 to 6 th August 2007 by making use of MTD function via member "AugustOrdersTillDate".
 
  •  WITH MEMBER [Date].[Calendar].[AugustOrdersTillDate] AS
        Aggregate(
            MTD([Date].[Calendar].[Date].&[20070806])
        )
    SELECT
        {[Date].[Calendar].[AugustOrdersTillDate]
         ,[Date].[Calendar].[Date].&[20070801]:[Date].[Calendar].[Date].&[20070806]
        } ON COLUMNS,
        [Product].[Category].Children ON ROWS
    FROM
        [Adventure Works]
    WHERE
        [Measures].[Order Quantity]







No comments:

Post a Comment