Compartilhar via


DistinctCount (MDX)

Retorna o número de tuplas distintas, não vazias em um conjunto.

Sintaxe

DistinctCount(Set_Expression)

Argumentos

  • Set_Expression
    Uma expressão MDX (Multidimensional Expressions) válida que retorna um conjunto.

Comentários

A função DistinctCount é equivalente a Count(Distinct(Set_Expression), EXCLUDEEMPTY).

Exemplos

A consulta a seguir mostra como usar a função 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]