Forum Discussion
Retention Rate
- 4 years ago
Hi Anonymous
Here's an option for a Retention Rate measure.
It gets a list of employees at the start of the period, another list of those at the end, then uses INTERSECT to see employees in both. I've assumed a blank end date means the employee hasn't left.
The IF function is to stop you getting a retention rate until the period is finished.
Retention Rate = VAR _StartOfPeriod = MIN('Date'[Date]) VAR _EndOfPeriod = MAX('Date'[Date]) VAR _Result = IF( TODAY() >= _EndOfPeriod, VAR _EmployeesAtStart = CALCULATETABLE( VALUES(Employees[Employee_ID]), Employees[StartDate] <= _StartOfPeriod, Employees[EndDate] >= _StartOfPeriod || ISBLANK(Employees[EndDate]) ) VAR _EmployeesAtEnd = CALCULATETABLE( VALUES(Employees[Employee_ID]), Employees[StartDate] <= _EndOfPeriod, Employees[EndDate] >= _EndOfPeriod || ISBLANK(Employees[EndDate]) ) VAR _NoOFEmployeesAtStartAndEnd = COUNTROWS( INTERSECT(_EmployeesAtStart, _EmployeesAtEnd) ) RETURN DIVIDE(_NoOFEmployeesAtStartAndEnd, COUNTROWS(_EmployeesAtStart)) ) RETURN _Result
Anonymous
OK. let's try disconnecting it from the rest of the model (or importing a new copy of the date table and using that)
PaulOlding Wooow... It worked. I think... I have to make a hand calculation to check, but the values make some sense. I didnt knew I could use tables with no relation. Why does that work and not with?
- PaulOlding4 years agoSolution Sage
Anonymous
For this measure we're handling filtering the fact table based on dates in the CALCULATETABLEs. Let's say the date table was connected to start date and was filtered to March 2021. The fact table would be filtered to include only rows where start date is in March 2021. So your list of employees at the end of the period would not include those that started before March 2021.
Another option would be to use CROSSFILTER(Date[Date], Fact[Start Date], None) as a calculate modifier. That would disable the relationship while performing the calculation.