Usando funções de membro

Uma função membro é uma função de Expressões Multidimensionais (MDX) que devolve um membro. As funções membros, tal como as tuplas e as funções de conjunto, são essenciais para negociar as estruturas multidimensionais encontradas nos Serviços de Análise.

Das muitas funções membros em MDX, a mais importante é a função CurrentMember , que é usada para determinar o membro atual numa hierarquia. A consulta seguinte ilustra como usá-lo, juntamente com as funções Pai, Antepassado e Membro Anterior :

WITH  
//Returns the name of the currentmember on the Calendar hierarchy  
MEMBER MEASURES.[CurrentMemberDemo] AS [Date].[Calendar].CurrentMember.Name  
//Returns the name of the parent of the currentmember on the Calendar hierarchy  
MEMBER MEASURES.[ParentDemo] AS [Date].[Calendar].CurrentMember.Parent.Name  
//Returns the name of the ancestor of the currentmember on the Calendar hierarchy at the Year level  
MEMBER MEASURES.[AncestorDemo] AS ANCESTOR([Date].[Calendar].CurrentMember, [Date].[Calendar].[Calendar Year]).Name  
//Returns the name of the member before the currentmember on the Calendar hierarchy  
MEMBER MEASURES.[PrevMemberDemo] AS [Date].[Calendar].CurrentMember.Prevmember.Name  
SELECT{MEASURES.[CurrentMemberDemo],MEASURES.[ParentDemo],MEASURES.[AncestorDemo],MEASURES.[PrevMemberDemo] } ON 0,  
[Date].[Calendar].MEMBERS ON 1  
FROM [Adventure Works]