Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 SQL Server 2008 Forums
 Analysis Server and Reporting Services (2008)
 Counting Distinct IDs from two sets

Author  Topic 

DP978
Constraint Violating Yak Guru

269 Posts

Posted - 2012-03-09 : 10:02:50
Hi all,

I have two sets I need to create and then union to count distinct IDs. The premise is this, Set A is for Condition 1 and Set B is for condition 2. We have an ID attribute and there are a lot of filters neccesary to figure out the sets. My question is how can I generate a set that contains on IDs but filters on critera. Example of set A:

WITH

//Set one members who had a service listed in table CDC-J
SET [A] AS
(
Except
(
{[Member].[Member].MEMBERS}
,[Member].[Member].DefaultMember
)

, [Member].[Is Diabetic].&[Y]
,[Member].[Has Continuous Enrollment].&[Y]
,{
[Member].[RC].&[RC1]
,[Member].[RC].&[RC2]
}
,{[Member].[Age Years].&[18] : [Member].[Age Years].&[75]}
,[Service].[Table Key].&[CDC-J]
,[Service Date].[Year].&[2010]
)

SET [B] AS
(
Except
(
{[Member].[Member].MEMBERS}
,[Member].[Member].DefaultMember
)

, [Member].[Is Diabetic].&[Y]
,[Member].[Has Continuous Enrollment].&[Y]
,{
[Member].[RC].&[RC1]
,[Member].[RC].&[RC2]
}
,{[Member].[Age Years].&[18] : [Member].[Age Years].&[75]}
,[Service].[Table Key].&[CDC-K]
,[Service Date].[Year].&[2010]
)

Note that here the sets bring in tuples which are not unique, I want to only bring in Member].[Member].MEMBERS. I hope this question makes sense. Thanks for any and all help!
-Derek

   

- Advertisement -