指定された集合を評価し、その集合から重複タプルを削除し、その結果の集合を返します。
構文
Distinct(Set_Expression)
引数
Set_Expression
集合を返す有効な多次元表現(MDX)式。
Remarks
Distinct関数が指定された集合内で重複タプルを見つけた場合、関数は重複タプルの最初のインスタンスのみを保持し、集合の順序はそのままにします。
Examples
以下の例クエリは、名前付き集合に対してDistinct関数を使う方法と、Count関数を使って集合内の異なるタプルの数を求める方法を示しています。
WITH SET MySet AS
{[Customer].[Customer Geography].[Country].&[Australia],[Customer].[Customer Geography].[Country].&[Australia],
[Customer].[Customer Geography].[Country].&[Canada],[Customer].[Customer Geography].[Country].&[France],
[Customer].[Customer Geography].[Country].&[United Kingdom],[Customer].[Customer Geography].[Country].&[United Kingdom]}
MEMBER MEASURES.SETCOUNT AS
COUNT(MySet)
MEMBER MEASURES.SETDISTINCTCOUNT AS
COUNT(DISTINCT(MySet))
SELECT {MEASURES.SETCOUNT, MEASURES.SETDISTINCTCOUNT} ON 0,
DISTINCT(MySet) ON 1
FROM [Adventure Works]