Compartir a través de


DistinctCount (MDX)

Devuelve el número de tuplas distintas y no vacías de un conjunto.

Sintaxis

DistinctCount(Set_Expression)

Argumentos

  • Set_Expression
    Expresión MDX válida que devuelve un conjunto.

Notas

La función DistinctCount es equivalente a Count(Distinct(Set_Expression), EXCLUDEEMPTY).

Ejemplos

La consulta siguiente muestra el modo de usar la función 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]