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
 

Retrieve the first 5 members from a set.

There are a few ways to retrieve the first n members from a set.  The following examples will return the first 5 members from a set without regard to ordering.

The query below uses the Head function to return the first 5 members in the set.

SELECT {[Measures].[Sales Amount]} ON 0,
HEAD([Product].[Product Categories].[Subcategory].[Gloves].Children,5) ON 1
FROM [Adventure Works]

The following query uses the Item function to retrieve items 0 through 4 in the set.

SELECT {[Measures].[Sales Amount]} ON 0,
{[Product].[Product Categories].[Subcategory].[Gloves].Children.Item(0):[Product].[Product Categories].[Subcategory].[Gloves].Children.Item(4)} ON 1
FROM [Adventure Works]

The query below uses the Subset function return the first 5 members in the set.

SELECT {[Measures].[Sales Amount]} ON 0,
SUBSET([Product].[Product Categories].[Subcategory].[Gloves].Children, 0, 5) ON 1
FROM [Adventure Works]



 

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