Distinct (MDX)

Evaluates a specified set, removes duplicate tuples from the set, and returns the resulting set.

Syntax

Distinct(Set_Expression)

Arguments

  • Set_Expression
    A valid Multidimensional Expressions (MDX) expression that returns a set.

Remarks

If the Distinct function finds duplicate tuples in the specified set, the function keeps only the first instance of the duplicate tuple while leaving the order of the set intact.

Examples

The following MDX query shows the usage of the Distinct function and the results that the function retrieves from the sample cube, AdventureWorks.

Select Distinct({[Geography].[Country].&[Australia],

[Geography].[Country].&[France],

[Geography].[Country].&[Canada],

[Geography].[Country].&[Australia],

[Geography].[Country].&[United States],

[Geography].[Country].&[United Kingdom],

[Geography].[Country].&[Canada]}) on 1,

[Measures].[Reseller Sales Amount] on 0

from [Adventure Works]

As shown in the following results, the order of the results in the set is the same as in the tuples in the query. However, duplicate tuples have been removed.

Reseller SalesAmount

Australia$1,594,335.38

France$4,607,537.94

Canada$14,377,925.60

United States$53,607,801.21

United Kingdom$4,279,008.83

See Also

Reference

MDX Function Reference (MDX)

Help and Information

Getting SQL Server 2005 Assistance

Change History

Release History

15 September 2007

New content:
  • Added example.

17 July 2006

Changed content:
  • Updated syntax and arguments to improve clarity.