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: Ordinal
Category: Metadata
Description: The Ordinal function returns a zero-based value for the specified level.
Syntax: «Level».ORDINAL
Technet Link: MDX Ordinal Function




The following query uses the Ordinal function to determine the level for the current member of the Fiscal hierarchy.
 
WITH
      MEMBER [Measures].[DayOrMonthLevel] AS
      IIF([Date].[Fiscal].CurrentMember.Level.Ordinal = 4, "Month Level", "Day Level")
SELECT
      {[Measures].[DayOrMonthLevel]} ON COLUMNS,
      DESCENDANTS([Date].[Fiscal], 4, SELF_AND_AFTER) ON ROWS
FROM
      [Adventure Works]
 
 

 
The query below shows the ordinal value for levels under the Fiscal hierarchy in the Date dimension.
 
WITH
      MEMBER [Measures].[FiscalYearOrd] AS
      [Date].[Fiscal].[Fiscal Year].Ordinal
      MEMBER [Measures].[FiscalSemesterOrd] AS
      [Date].[Fiscal].[Fiscal Semester].Ordinal
      MEMBER [Measures].[FiscalQuarterOrd] AS
      [Date].[Fiscal].[Fiscal Quarter].Ordinal
      MEMBER [Measures].[MonthOrd] AS
      [Date].[Fiscal].[Month].Ordinal
      MEMBER [Measures].[DateOrd] AS
      [Date].[Fiscal].[Date].Ordinal
SELECT
      {[Measures].[FiscalYearOrd], [Measures].[FiscalSemesterOrd], [Measures].[FiscalQuarterOrd], [Measures].[MonthOrd], [Measures].[DateOrd]} ON COLUMNS
     
FROM
      [Adventure Works]
 
 

 
 

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