Hello Experts
I am trying to pick the correct location for all my "Encounter" types based on effective date. I want to write something like if loc is null and if "Encounter" type effective date is less than "Enrollment" type effective date or if effective date is in between "Enrollment" type effective date and ENDT return the Loc value for "Enrollment" type. Can you please help me or suggest any other way this can be done
Thank you I appreciate any help
MemberNumber EffectiveDate ENDT Loc Type 20040300416000 2/5/2019 10/30/2019 RUHS - LAKE ELSINORE Enrollment 20040300416000 2/15/2019 12/31/2099
Encounter 20040300416000 3/5/2019 12/31/2099
Encounter 20040300416000 4/2/2019 12/31/2099
Encounter 20040300416000 4/23/2019 12/31/2099
Encounter 20040300416000 5/23/2019 12/31/2099
Encounter 20040300416000 8/9/2019 12/31/2099
Encounter 20040300416000 10/31/2019 2/3/2020 RUHS - CORONA Enrollment 20040300416000 2/5/2020 12/31/2099
Encounter 20040300416000 3/9/2020 12/31/2099
Encounter 20040300416000 3/11/2020 12/31/2099 RUHS - CORONA Enrollment 20040300416000 3/19/2020 12/31/2099
Encounter 20040300493400 8/2/2019 12/31/2099
Encounter 20040300493400 3/3/2020 12/31/2099
Encounter