I am trying to get my brain around this. i have a need to create a table that includes the following:
Client, test, and then a cound of individual tests with the following rules. This table will be used as a dimension table for a cube
Level0 means include all the tests for the client within a time period
Level1 means count only once any test performed within a time period of 1 month from the first test (can be 30 days if necessary)
Level2 means count only once any test performed within a time period of 2 months from the first test (can be 60 days if necessary)
select
clientID,
testdimid,
COUNT(testid) as Level0,--this one gets everything, doesn't exclude duplicate data
datedimid, --do I need this date here?
???? as Level1, --I want to count only the first result in a one month period
???? as Level2 -- I want to count only the first result in a two month period
from
Testtable
group by
DateoftestDimId,
PatientID,
TestDimId
thanks for any help or tips.
TJ
Client, test, and then a cound of individual tests with the following rules. This table will be used as a dimension table for a cube
Level0 means include all the tests for the client within a time period
Level1 means count only once any test performed within a time period of 1 month from the first test (can be 30 days if necessary)
Level2 means count only once any test performed within a time period of 2 months from the first test (can be 60 days if necessary)
select
clientID,
testdimid,
COUNT(testid) as Level0,--this one gets everything, doesn't exclude duplicate data
datedimid, --do I need this date here?
???? as Level1, --I want to count only the first result in a one month period
???? as Level2 -- I want to count only the first result in a two month period
from
Testtable
group by
DateoftestDimId,
PatientID,
TestDimId
thanks for any help or tips.
TJ