I have to identify clients with 3 consecutive appointments. The client had to have shown (Status="SH") or completed (status="CO")the appointment for it to count. The tricky part is I need to skip the count for appointments that were canceled(status="CA") because of any reason other than a late cancellation (cancellation_reason ="LC"). Below is my current formula.
(Previous ({Patient_Clin_Tran.patient_id})= {Patient_Clin_Tran.patient_id}
and
({Patient_Clin_Tran.status} in [ "CO" ,"SH"] and
previous({Patient_Clin_Tran.status})in [ "CO" ,"SH"] and
next({Patient_Clin_Tran.patient_id})= {Patient_Clin_Tran.patient_id} and
next({Patient_Clin_Tran.status})in [ "CO" ,"SH"] )) = true
(Previous ({Patient_Clin_Tran.patient_id})= {Patient_Clin_Tran.patient_id}
and
({Patient_Clin_Tran.status} in [ "CO" ,"SH"] and
previous({Patient_Clin_Tran.status})in [ "CO" ,"SH"] and
next({Patient_Clin_Tran.patient_id})= {Patient_Clin_Tran.patient_id} and
next({Patient_Clin_Tran.status})in [ "CO" ,"SH"] )) = true