Hello everyone,
I need assistance with pulling data from the data lake using Effective Date and AsOfDate in Data Lake Compass. Specifically, I am working with the HRT system, querying the CRHH_HCM_Employee and CRHH_HCM_EmployeeBenefit business classes.
Here’s the scenario:
I have a list of 5 employees:
Employee - EmployeeName - RelationshipStatus
- 121 - John - Active
- 122 - Andy - Active
- 123 - Kelly - LOA
- 124 - Susan - Term Final (Effective 2024-09-09)
- 125 - Nike - Term Pay Pending
Objective 1: Pulling Active, LOA, and Term Pay Pending Employees passing latest date range
I want to retrieve records for employees who are in statuses of Active, LOA, or Term Pay Pending, excluding those who are Term Final, by using the employee benefit enrollment dates.
I am applying the following condition:
FROM
CRHH_HCM_EmployeeBenefit EB
JOIN CRHH_HCM_Employee E ON EB.Employee = E.Employee
WHERE
(
E.RelationshipStatus IN ('ACTIVE', 'LOA', 'TERM PAY PENDING')
)
AND EB.DateRangeBegin <= '2024-09-11'
AND (EB.DateRangeEnd >= '2024-09-11' OR EB.DateRangeEnd IS NULL)
For this scenario, I expect to see 4 records, excluding employee 124 (Susan), who was terminated with a final status effective on 2024-09-09. (Which is working fine and I'm seeing the expected output)
Objective 2:
In another scenario, if I pass a past date range as:
FROM
CRHH_HCM_EmployeeBenefit EB
JOIN CRHH_HCM_Employee E ON EB.Employee = E.Employee
WHERE
(
E.RelationshipStatus IN ('ACTIVE', 'LOA', 'TERM PAY PENDING')
)
AND EB.DateRangeBegin <= '2024-01-01'
AND (EB.DateRangeEnd >= '2024-01-01' OR EB.DateRangeEnd IS NULL)
I expect to see all 5 employee records, including Susan (Employee 124), as she was still active on that date.(However, I'm not seeing all the 5 employees because, the query is considering the latest RelationshipStatus as TERM FINAL and excluding Employee 124)
Question:
How can I effectively pull data based on the Effective Date and AsOfDate in Compass to accommodate these scenarios? In IPD, using the Landmark node, we have user-defined fields for these dates.
Is there a similar approach or best practice in Data Lake Compass that would allow me to handle this?
For understanding please refer the snip:
Any insights or advice on structuring this query would be greatly appreciated!
Thank you!