Forum Discussion
Retained Employees with TenureDate table
LaBicicleta , What is you source data, where we can see Alice's start and end date.
If you have a start and end date. Refer to the file attached, which can help
Hi amitchandak , thanks for reaching out!
The issue is that we have a lot of rehires here, so there's multiple periods of tenure that need considered, I can't just grab the current "End Date" from the employee table if they're a rehire.
However, what I can do is use PowerQuery to generate a table that would have one row for each employee-tenure period, a la:
| Row ID | Employee ID | Tenure_Start | Tenure_End |
| 1 | Alice | 3/1/2018 | 8/20/2019 |
| 2 | Alice | 10/31/2019 | 12/31/2049 |
| 3 | Bob | 7/1/2021 | 12/31/2049 |
I can certainly try this out.
I did try to pursue a solution with my existing two tables in the original post, and I came up with this English explanation of what I envision as the solution:
- Filter for all rows where the [TenureDate] is tblCalendar[Date] or DATEADD(tblCalendar[Date],-1,YEAR).
- Summarize this table and group by [Employee ID], counting [EmployeeID] instances as "TenuredInstancesOfInterest".
- Filter this resulting table for where count of the virtual table is 2.
- Count rows of this resulting-resulting table.
My attempted solution was this:
=COUNTROWS(
FILTER(
SUMMARIZE(
FILTER(qryEmployeeActiveTime,
OR(
[TenureDate]=DATEADD(tblCalendar[Date],0,YEAR),
[TenureDate]=DATEADD(tblCalendar[Date],-1,YEAR)
)
),
[EmployeeID],
"TenureInstancesOfInterest",COUNT([EmployeeID])
),
[TenureInstancesOfInterest]=2
)
)