Skip to main content

Distinct Member Count

Distinct Member Count

In some cases, for a given cell, you want to count the number of distinct members of some particular level. For example, the DocD dimension includes the level Doctor. We could count the number of unique doctors who are primary care physicians for any given set of patients. To do so, we define a calculated measure that uses the following value_expression:

COUNT([docd].[h1].[doctor].MEMBERS,EXCLUDEEMPTY)

We can use this measure in a query as follows:

WITH MEMBER MEASURES.[distinct doctor count] AS 'COUNT(docd.doctor.MEMBERS,EXCLUDEEMPTY)' 
SELECT MEASURES.[distinct doctor count] ON 0, aged.[age bucket].MEMBERS ON 1 FROM demomdx
 
                        distinct doctor co
1 0 to 9                                 38
2 10 to 19                               38
3 20 to 29                               38
4 30 to 39                               40
5 40 to 49                               41
6 50 to 59                               40
7 60 to 69                               33
8 70 to 79                               31
9 80+                                    28
FeedbackOpens in a new tab