Events
Mar 31, 11 PM - Apr 2, 11 PM
The biggest SQL, Fabric and Power BI learning event. March 31 – April 2. Use code FABINSIDER to save $400.
Register todayThis browser is no longer supported.
Upgrade to Microsoft Edge to take advantage of the latest features, security updates, and technical support.
Returns the level whose position in a dimension or hierarchy is specified by a numeric expression or whose name is specified by a string expression.
Numeric expression syntax
Hierarchy_Expression.Levels( Level_Number )
String expression syntax
Hierarchy_Expression.Levels( Level_Name )
Hierarchy_Expression
A valid Multidimensional Expressions (MDX) expression that returns a hierarchy.
Level_Number
A valid numeric expression that specifies a level number.
Level_Name
A valid string expression that specifies a level name.
If a level number is specified, the Levels function returns the level associated with the specified zero-based position.
If a level name is specified, the Levels function returns the specified level.
Note
Use the string expression syntax for user-defined functions.
The following examples illustrate each of the Levels function syntaxes.
The following example returns the Country level:
SELECT [Geography].[Geography].Levels(1) ON 0
FROM [Adventure Works]
The following example returns the Country level:
SELECT [Geography].[Geography].Levels('Country') ON 0
FROM [Adventure Works]
Events
Mar 31, 11 PM - Apr 2, 11 PM
The biggest SQL, Fabric and Power BI learning event. March 31 – April 2. Use code FABINSIDER to save $400.
Register today