Export (0) Print
Expand All
Avg
IIf
Lag
Max
Min
Mtd
Qtd
Sum
Var
Wtd
Ytd
Expand Minimize
0 out of 4 rated this helpful - Rate this topic

CurrentMember (MDX)

Updated: 17 July 2006

Returns the current member along a specified hierarchy during iteration.


Hierarchy_Expression.CurrentMember
Hierarchy_Expression

A valid Multidimensional Expressions (MDX) expression that returns a hierarchy.

When iterating through a set of hierarchy members, at each step in the iteration, the member being operated upon is the current member. The CurrentMember function returns that member.

ms144948.note(en-US,SQL.90).gifImportant:
When a dimension contains only a single visible hierarchy, the hierarchy can be referred to either by the dimension name or by the hierarchy name, because the dimension name is resolved to its only visible hierarchy. For example, Measures.CurrentMember is a valid MDX expression because it resolves to the only hierarchy in the Measures dimension.

Example

The following example returns the order quantity of each product and the percentage of order quantities by category and model, from the Adventure Works cube. The CurrentMember function identifies the product whose order quantity is to be used during calculation.

WITH 
   MEMBER [Measures].[Order Percent by Category] AS
   CoalesceEmpty
   ( 
      ([Product].[Product Categories].CurrentMember,
        Measures.[Order Quantity]) / 
          (
           Ancestor
           ( [Product].[Product Categories].CurrentMember, 
             [Product].[Product Categories].[Category]
           ), Measures.[Order Quantity]
       ), 0
   ), FORMAT_STRING='Percent'
SELECT 
   {Measures.[Order Quantity],
      [Measures].[Order Percent by Category]} ON COLUMNS,
{[Product].[Product].Members} ON ROWS
FROM [Adventure Works]
WHERE {[Date].[Calendar Year].[Calendar Year].&[2003]}

Release History

17 July 2006

Changed content:
  • Updated syntax and arguments to improve clarity.
  • Added updated examples.
Did you find this helpful?
(1500 characters remaining)
Thank you for your feedback

Community Additions

ADD
Show:
© 2014 Microsoft. All rights reserved.