Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 
proctors
Creator
Creator

Count of Distinct When Two Conditions met

I need help with an expression under the following condition:

Give me the count of patients (MRN) who have zero Office Visits ([OFFICE VISIT]) and at least one Care Coordination [CARE COORDINATION])

1 Solution

Accepted Solutions
sunny_talwar

May be this:

Count(DISTINCT {<MRN = {"=Count({<[OFFICE VISIT] = {'Office Visit'}>}MRN) = 0 and Count({<[OFFICE VISIT] = {'Care Coordination'}>}MRN) >= 1"}>} MRN)

View solution in original post

6 Replies
krishnacbe
Partner - Specialist III
Partner - Specialist III

Share some sample data and expected output

sunny_talwar

May be like this

Count(DISTINCT {<[OFFICE VISIT] = {0}, [CARE COORDINATION] = {'>= 1'}>}MRN)

proctors
Creator
Creator
Author

This is close...but is there a way for it to do a count of all of the Office Visits for that patient and return the count of MRN when that Office Visit Count is 0 and the count of care coordination is >1?

This basically needs to collapse across the following:

Patient A     3/2/17     Office Visit

Patient A     3/4/17     Care Coordination

Patient B     3/1/17     Care Coordination

Patient C     2/4/17     Care Coordination

The output would be that we have MRN = 2 because only two patients have only Care coordination visits (A does not qualify because Office Visit = 1 for them).

sunny_talwar

May be this:

Count(DISTINCT {<MRN = {"=Count({<[OFFICE VISIT] = {'Office Visit'}>}MRN) = 0 and Count({<[OFFICE VISIT] = {'Care Coordination'}>}MRN) >= 1"}>} MRN)

proctors
Creator
Creator
Author

Definitely it! I'll have to look into that method you used where you defined MRN, I haven't seen that before in set analysis

sunny_talwar

Check this out here (Under Search String):

A Primer on Set Analysis