Final code ended up looking like this:
All Employees = countrows ('Employees')
Terminations =
Calculate(
Countrows('Employees'),
USERELATIONSHIP('Employees'[End Date],'Calendar'[Date])
)
Active Employees =
AVERAGEX(
VALUES('Calendar'[Date]),
VAR CurrentDate = 'Calendar'[Date]
VAR HiredBeforeCurrentDate =
Filter(
ALL('Employees'[Start Date]),
'Employees'[Start Date] <= CurrentDate
)
VAR HiredAfterCurrentDate =
FILTER(
ALL('Employees'[End Date]),
OR('Employees'[End Date] >= CurrentDate, isblank('Employees'[End Date])
)
)
RETURN
CALCULATE(
Countrows('Employees'),
HiredBeforeCurrentDate,
HiredAfterCurrentDate,
ALL('Calendar')
))
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…