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: Lead
Category: Navigation
Description: The Lead function returns a member that is n positions following the supplied member within a dimension. Typical uses for the Lead function are to traverse or create a date range.
Syntax: «Member».LEAD( «Numeric Expression» )
Technet Link: MDX Lead Function




Typical uses for the Lead function are to traverse or create a date range. This query will return the member that is 5 positions past the supplied member of January 15, 2004.
 

SELECT
      {} ON COLUMNS,
      {[Date].[Date].[January 15, 2004].Lead(5)} ON ROWS
FROM
      [Adventure Works]
 
 

 
To create a set of days that range from January 15, 2004 to 30 days in the future, you would use the following query:
 

SELECT
      {} ON COLUMNS,
      {[Date].[Date].[January 15, 2004]:[Date].[Date].[January 15, 2004].Lead(30)} ON ROWS
FROM
      [Adventure Works]
 
 

 
You could also use negative numbers for the numeric expression and the function will return n positions before the specified member. However, it is recommended that you use the Lag function to retrieve members that are before before the supplied member.
 

SELECT
      {} ON COLUMNS,
      {[Date].[Date].[January 15, 2004].Lead(-5)} ON ROWS
FROM
      [Adventure Works]
 
 

 
 

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