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: Except
Category: Set
Description: The Except function removes members from one set that exist in another set.  There is an optional flag (ALL) that will let you retain duplicates across the sets.
Syntax: EXCEPT( «Set1», «Set2»[, ALL] )
Technet Link: MDX Except Function




The following query removes August 10, 2004 from the children of the August 2004 children.
 

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

 
You can achieve the same result by using the - (minus) operator as shown below.
 

SELECT
      {} ON COLUMNS,
      {[Date].[Calendar].[Month].[August 2004].Children} - {[Date].[Calendar].[August 10, 2004]} ON ROWS
FROM
      [Adventure Works]
 
 

 
The query below shows how you can remove multiple members from a set using the Except function. In this case, the first three children of the August 2004 members are removed.
 

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

 
 

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