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

Get Fabric Certified for FREE during Fabric Data Days. Don't miss your chance! Request now

Reply
Anonymous
Not applicable

Active count with rehire date and multiple termination dates

Hello I am stuck on how to finalize this formula with a lot of different parameters involved.

 

So I have an active count function that allows me to see active staff as shown below. 

 

Employee Count =
VAR selectedDate =
    MAX ('Date'[Date])
VAR result =
    CALCULATE (
        COUNTROWS ( 'Report Data'),
         ALLSELECTED('Date'),
            'Date'[Date]<= selectedDate,
            ISBLANK('Report Data'[Termination_Date])
                || 'Report Data'[Termination_Date]>= selectedDate

    )

Return

result
 
It works great! But what I need to take into consideration is Rehire date and termination dates. 
 
The way the data is setup is when someone is terminated their termination date goes into the termination column. But if they are rehired, then the termination date goes into a column called Previous termination date. If they terminate again then the termination date is populated in the termination date column. And the previous termination is based on the original hire date. 
 
So what I want to do is basically count active staff based on hire and rehire date, then if there is a rehire date look at previous terminate date and get the active count between those two. But if there is a second termination date, then take the original hire date and previous termination date and count active, then count a second time for Rehire and Termination date. So essentially counting the same person twice if they have two hire and termination dates. but only within their working time. 
 
Table columns:
 
Full Name
Position
Hire Date
Rehire Date
Termination Date
Previous Termination date
 
From a basic perpective, I am just trying to get a total active count including hire and rehires. 
 
Let me know if this is possible, I am not sure how to incorporate this into my initial active count by timeframe. 

Thank you!
5 REPLIES 5
Anonymous
Not applicable

here is the data. So when someone is hired, they have just the hired data filled out. If they terminate, then they have both. Then if they rehire, they will have 3 dates. Then if they terminate again, they will have 4 dates. I am trying to figure out how to show active count based on those 4 dates. 

Screenshot 2023-06-26 121116.png

What if they get rehired a third time etc?

 

Unpivot you data. Then you can count all employees without a termination date plus all employees where the maximum hire date is greater than the maximum termination date.

Anonymous
Not applicable

Thank you! So what if I wanted to count the person twice? So when they are rehired, they would count again as a new person in the data? And luckely the data only goes out two times, so hire and then rehire. 

Please provide sample data (with sensitive information removed) that covers your issue or question completely, in a usable format (not as a screenshot).
https://community.fabric.microsoft.com/t5/Community-Blog/How-to-provide-sample-data-in-the-Power-BI-...
Please show the expected outcome based on the sample data you provided.

https://community.fabric.microsoft.com/t5/Desktop/How-to-Get-Your-Question-Answered-Quickly/m-p/1447...

lbendlin
Super User
Super User

You may want to consider pivoting your requirement from hire/termination dates to "calendar of active days for each employee".  That list is static, and can be precomputed outside of Power BI. Even if you have tens of thousands of employees it will also be rather small.

 

Please provide sanitized sample data that fully covers your issue.
Please show the expected outcome based on the sample data you provided.

Helpful resources

Announcements
Fabric Data Days Carousel

Fabric Data Days

Advance your Data & AI career with 50 days of live learning, contests, hands-on challenges, study groups & certifications and more!

October Power BI Update Carousel

Power BI Monthly Update - October 2025

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

FabCon Atlanta 2026 carousel

FabCon Atlanta 2026

Join us at FabCon Atlanta, March 16-20, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.

Top Solution Authors
Top Kudoed Authors