次の方法で共有


DistinctCount (MDX)

セット内の重複しない空以外の組の数を返します。

構文

DistinctCount(Set_Expression)

引数

  • Set_Expression
    セットを返す有効な多次元式 (MDX) 式です。

説明

DistinctCount 関数は、Count(Distinct(Set_Expression), EXCLUDEEMPTY) と等価です。

次のクエリでは、DistinctCount 関数の使用方法を示します。

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]}

*

{([Date].[Calendar].[Date].&[20010701],[Measures].[Internet Sales Amount] )}

//Returns the value 3 because Internet Sales Amount is null

//for the UK on the date specified

MEMBER MEASURES.SETDISTINCTCOUNT AS

DISTINCTCOUNT(MySet)

SELECT {MEASURES.SETDISTINCTCOUNT} ON 0

FROM [Adventure Works]