Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 
Anonymous
Not applicable

5 or More Visits or Dates within 180 days

Hello,

I have the following table with two columns:  TestID (for userID)   and AppointmentDate of when the user visited the practice.

I need help is to create a flag that will flag if 5 or more visits took place within am 180 day period regardless of when the AppointmentDate (meaning it does not have to be first appointment date it can be appointment date that had 4 more visits after all under 180 days combined).

I have used above function to calculate the difference in days between the preceding and the following date (not sure if that helps).

but I am stuck going forward.  Please help.

TestIdAppointmentDateCount(AppointmentDate)AppointmentDate - Above(AppointmentDate)
136a2014-12-291-
136a2014-12-3112
136a2015-02-13144
136a2015-03-03118
136a2015-03-18115
136a2015-04-02115
136a2015-04-24122
136a2015-05-06112
136a2015-05-22116
136a2015-06-18127
136a2015-09-03177
136a2015-12-07195
136a2016-03-09193
136a2016-06-231106
136a2016-09-29198
2 Replies
sunny_talwar

What is the expected output you are wishing to see based on the data that you have provided above?

swuehl
MVP
MVP

So which of these records should be flagged?