Utilizzo delle funzioni membroUsing Member Functions

SI APPLICA A:sìSQL Server Analysis ServicesnoAzure Analysis ServicesAPPLIES TO:yesSQL Server Analysis ServicesnoAzure Analysis Services

Una funzione membro è una funzione MDX (Multidimensional Expressions) che restituisce un membro.A member function is an Multidimensional Expressions (MDX) function that returns a member. Le funzioni membro, come le funzioni di tupla e le funzioni sui set, sono essenziali per la negoziazione delle strutture multidimensionali che si trovano in Analysis ServicesAnalysis Services.Member functions, like tuple functions and set functions, are essential to negotiating the multidimensional structures found in Analysis ServicesAnalysis Services.

Delle molte funzioni membro in MDX, la più importante è il CurrentMember funzione, viene utilizzato per determinare il membro corrente in una gerarchia.Of the many member functions in MDX, the most important is the CurrentMember function, which is used to determine the current member on a hierarchy. La query seguente viene illustrato come utilizzare, insieme al padre, predecessore, e Prevmember funzioni:The following query illustrates how to use it, along with the Parent, Ancestor, and Prevmember functions:

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]

Vedere ancheSee Also

Funzioni ( La sintassi MDX ) Functions (MDX Syntax)
Utilizzo di funzioni di tupla Using Tuple Functions
Uso delle funzioni sui setUsing Set Functions