DistinctCount (MDX)

Restituisce il numero di tuple distinte e non vuote in un set.

Sintassi

DistinctCount(Set_Expression)

Argomenti

  • Set_Expression
    Espressione MDX (Multidimensional Expression) valida che restituisce un set.

Osservazioni

La funzione DistinctCount equivale a Count(Distinct(Set_Expression), EXCLUDEEMPTY).

Esempi

Nell'esempio di query seguente viene illustrato l'utilizzo della funzione 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].&[1],[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]