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: TopSum
Category: Set
Description: The TopSum function returns a set that is sorted in descending order. The cumulative sum of this set is greater than or equal to the supplied value for the supplied measure.
Syntax: TOPSUM( «Set», «Value», «Numeric Expression» )
Technet Link: MDX TopSum Function




The query below returns a set of Products with the highest values whose cumulative Sales Amount total is greater than or equal to 10,000,000.
 

SELECT
      {[Measures].[Sales Amount]} ON COLUMNS,
      {TOPSUM([Product].[Product].[Product].Members, 10000000, [Measures].[Sales Amount])} ON ROWS
FROM
      [Adventure Works]
 
 

 
The following query returns a set of Dates from the Fiscal hierarchy of the Date dimension with the highest values whose cumulative Sales Amount is greater than or equal to 20,000,000.
 

SELECT
      {[Measures].[Sales Amount]} ON COLUMNS,
      TOPSUM([Date].[Fiscal].[Date].Members, 20000000, [Measures].[Sales Amount]) ON ROWS
FROM
      [Adventure Works]
 
 

 
 

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