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: Distinct
Category: Set
Description: The Distinct function removes duplicate tuples from the supplied set and returns a the unique set.
Syntax: DISTINCT( «Set» )
Technet Link: MDX Distinct Function




The query below would remove duplicate City members in the Geography hierarchy in the Geography dimension if they existed.
 

SELECT
      {} ON COLUMNS,
      DISTINCT([Geography].[Geography].[City].Members) ON ROWS
FROM
      [Adventure Works]
 
 

 
In the query below, you will notice that there are three Cities with the name Saint Ouen. Although the member name is a duplicate, each member has it's own unique name, therefore, they are not considered duplicates.
 
WITH
      MEMBER [Measures].[UniqName] AS
      [Geography].[Geography].CurrentMember.UniqueName
SELECT
      {[Measures].[UniqName]} ON COLUMNS,
      FILTER([Geography].[Geography].[City].Members, [Geography].[Geography].CurrentMember.Name = "Saint Ouen") ON ROWS
FROM
      [Adventure Works]
 
 

 
 

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