Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

Enhance your career with this limited time 50% discount on Fabric and Power BI exams. Ends August 31st. Request your voucher.

Reply
Anonymous
Not applicable

How to count terminated employeees based on date slicer???

Hello, I have been struggling with visualizing data regarding attrition rates.

I was trying to visualize the total hired employees by a slice filter of dates. I have figured out this by using another method; counting the employee_Id but still, I am wondering why the other method was not working.

 

Data table: HRDataset, Calendar

Column : 
* HRDataset - Employee_id, Hired_date,Terminated_date, Terminated_Status 
* Calendar - made by DAX using 

Calendar = CALENDAR(MINX(HRDATASET,HRDATASET[DateofHire]),MAXX(HRDATASET,HRDATASET[DateofTermination]))
The date column in the Calendar table was linked with the Date of Hire as a main active relationship.
----------
The method I used to calculate the total hired employee was
TotalEmployee = Calculate(DISTINCTCOUNT(HRDATASET[EmpID]), Filter(HRDATASET, HRDATASET[DateofHire] <= RELATED('Calendar'[Date])))
and to calculate the terminated employee
TerminatedEmployee(Challenge) = Calculate(COUNT(HRDATASET[EmpID]), Filter(HRDATASET,HRDATASET[DateofTermination] <= RELATED('Calendar'[Date])),USERELATIONSHIP('Calendar'[Date],HRDATASET[DateofTermination]))
 
With the outcome, I want to use the slice filter of before-dates, which means it needs to show the accumulated number for total hired employees & terminated employee
maria9182003_0-1681950438166.png

 

What I was simply thinking is to calculate the count of the date of hire of an employee when the date is less than the filter's date. Do you think this got error because of my idea????

 

 

Thanks 

0 REPLIES 0

Helpful resources

Announcements
July 2025 community update carousel

Fabric Community Update - July 2025

Find out what's new and trending in the Fabric community.

July PBI25 Carousel

Power BI Monthly Update - July 2025

Check out the July 2025 Power BI update to learn about new features.