@Charily; returned same date of hospital encounter using recommended formula.
@torolimon ; is your recommendation to add an alias for the ADT table? I'm currently using Pat_Enc_Hsp to capture ED/Inpatient visits and Pat_Enc_Appt to capture appointments within 4wks of last encounter.
Current Formula:
{@age} in 18.00 to 85.00 and
{ZC_PAT_CLASS.NAME} in ["Inpatient", "Emergency"] and
{PAT_ENC_HSP.ADT_PATIENT_STAT_C} in [2.00, 3.00] and
{@PCP Name} <> "provider name" and
{CLARITY_LOC.LOC_ID} in [???] and
{PAT_ENC_HSP.CONTACT_DATE} in dateadd('m',-1,CurrentDate)to CurrentDate and
{PAT_ENC_APPT.CONTACT_DATE}in {PAT_ENC_HSP.CONTACT_DATE} to {PAT_ENC_HSP.CONTACT_DATE}+28