Поделиться через


DistinctCount (многомерные выражения)

Возвращает количество неодинаковых, непустых кортежей в наборе.

Синтаксис

DistinctCount(Set_Expression)

Аргументы

  • Set_Expression
    Допустимое многомерное выражение, возвращающее набор.

Замечания

Функция 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].&[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]