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: Subset
Category: Set
Description: The Subset function returns a specified number of members from a set beginning with a specified zero-based start value.
Syntax: SUBSET( «Set», «Start»[, «Count»] )
Technet Link: MDX Subset Function




The query below returns one member from the August 2004 members starting at the 1st member (0 for zero-based index).
 

SELECT
      {} ON COLUMNS,
      SUBSET({[Date].[Calendar].[Month].[August 2004].Children}, 0, 1) ON ROWS
FROM
      [Adventure Works]
 
 

 
The query below returns five members from the August 2004 members starting at the 4th member (3 for zero-based index).
 

SELECT
      {} ON COLUMNS,
      SUBSET({[Date].[Calendar].[Month].[August 2004].Children}, 3, 5) ON ROWS
FROM
      [Adventure Works]
 
 

 
The query below asks for 3 members from the August 2004 members starting at the 30th member (29 for zero-based index).
 

SELECT
      {} ON COLUMNS,
      SUBSET({[Date].[Calendar].[Month].[August 2004].Children}, 29, 3) ON ROWS
FROM
      [Adventure Works]
 
Notice this query only returns two members instead of the three that were requested. This is because the third member (which would be August 32, 2004) doesn't exist.
 

 
 

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