Home      Functions     Common Solutions      Contact     






MDX Functions:
 
MDX Functions

 
Common Solutions

Common Solutions
 
Resource Links

MDX Books
MDX Related Software
MDX Related Blogs
 
Other Links

Contact Us
 
Microsoft SQL Server Analysis Services Function Page
Function Name: Count (Hierarchy Levels)
Category: Metadata
Description: The Count function, when applied to hierarchies, returns the number of levels within the specified hierarchy.
Syntax: «Hierarchy».LEVELS.COUNT
Technet Link: MDX Count (Hierarchy Levels) Function




The query below shows there are a total of six levels in the Fiscal Date hierarchy of the Date dimension.
 
WITH
      MEMBER [Measures].[NumberOfLevels] AS
      [Date].[Fiscal].Levels.Count
SELECT
      [Measures].[NumberOfLevels] ON COLUMNS
     
FROM
      [Adventure Works]
 
The six levels include: All Level Fiscal Year Fiscal Semester Fiscal Quarter Month Date
 

 
The query below shows there is one level in the Measures dimension.
 
WITH
      MEMBER [Measures].[NumberOfLevels] AS
      Measures.Levels.Count
SELECT
      [Measures].[NumberOfLevels] ON COLUMNS
     
FROM
      [Adventure Works]
 
 

 
 

 
Copyright 2008 by MDXpert.com.
 
Terms of Use                              Privacy Statement
 
Site Powered By - WinHost.Com