Usando funções de membro

Uma função membro é uma função de Expressões Multidimensionais (MDX) que retorna um membro. Funções membros, como funções tupla e 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 em uma hierarquia. A consulta a seguir ilustra como usá-la, junto com as funções Pai, Ancestral 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]