TheTheTheTheTheThe


In the "bol",

"distinctcount" is remarked as follow:

The DistinctCount function is equivalent to Count(Distinct(Set_Expression), EXCLUDEEMPTY). This function can be applied only on calculated measures, and it can involve only the topmost level.

Is "distinctcount" only applied on calc-measures

What's the meaning

I find that I can use it in non-calc-measures.

Any help




Re: what is the meaning of the remark of "distinctcount"?

Darren Gosbell


This is not very clear, I will see if I can explain it as I understand it.

> This function can be applied only on calculated measures

This means that any calcuated members that use this function must be in the measures "dimesion"

eg.

CREATE MEMBER Measures.MyCalculation AS 'DistinctCount(...)' will work

CREATE MEMBER Date.Calendar.MyCalculation AS 'DistinctCount(...)' will throw a sytnax error

> This function can be applied only on calculated measures, and it can involve only the topmost level

This means if you have two "John Smith" members that live in different cities, but you do a "DistinctCount(Customer.Name.Members)" then "John Smith" will only be counted once, because the city attribute is not referenced. You would need to do a "DistinctCount(Customer.Name.Members * Location.City.Members) to get both "John Smith" members counted distinctly.

Hope this helps







Re: what is the meaning of the remark of "distinctcount"?

TheTheTheTheTheThe

Darren Gosbell wrote:

This is not very clear, I will see if I can explain it as I understand it.

> This function can be applied only on calculated measures

This means that any calcuated members that use this function must be in the measures "dimesion"

eg.

CREATE MEMBER Measures.MyCalculation AS 'DistinctCount(...)' will work

CREATE MEMBER Date.Calendar.MyCalculation AS 'DistinctCount(...)' will throw a sytnax error

> This function can be applied only on calculated measures, and it can involve only the topmost level

This means if you have two "John Smith" members that live in different cities, but you do a "DistinctCount(Customer.Name.Members)" then "John Smith" will only be counted once, because the city attribute is not referenced. You would need to do a "DistinctCount(Customer.Name.Members * Location.City.Members) to get both "John Smith" members counted distinctly.

Hope this helps

Many Thanks.