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

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now! Learn more

Reply
benz-fsproduce
Frequent Visitor

Tenure Days

Hi, I am trying to calculate tenure days, in a new column, of employees based on my columns "last hire date" and "termination date". My current formula is: Tenure days = DATEDIFF(page[Last Hire Date], page[Termination Date], Day)

This formula only gives me the total tenure days of employees that have both a hire date and a termination date. So it is only counting the days of terminated employees. I want a formula that counts the tenure days of active employees as well. Thanks!

 

1 ACCEPTED SOLUTION
amitchandak
Super User
Super User

@benz-fsproduce , assume Termination Date is blank for active employess

 

Tenure days = DATEDIFF(page[Last Hire Date], coalesce(page[Termination Date], Today()) , Day)

Share with Power BI Enthusiasts: Full Power BI Video (20 Hours) YouTube
Microsoft Fabric Series 60+ Videos YouTube
Microsoft Fabric Hindi End to End YouTube

View solution in original post

2 REPLIES 2
HotChilli
Super User
Super User

You could create a variable (something like var1 = COALESCE ((terminationD, TODAY()) )

and then use the variable in the datediff.

I think COALESCE works in this context, if not you can explicitly check for a null or blank termination date .

amitchandak
Super User
Super User

@benz-fsproduce , assume Termination Date is blank for active employess

 

Tenure days = DATEDIFF(page[Last Hire Date], coalesce(page[Termination Date], Today()) , Day)

Share with Power BI Enthusiasts: Full Power BI Video (20 Hours) YouTube
Microsoft Fabric Series 60+ Videos YouTube
Microsoft Fabric Hindi End to End YouTube

Helpful resources

Announcements
Power BI DataViz World Championships

Power BI Dataviz World Championships

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now!

December 2025 Power BI Update Carousel

Power BI Monthly Update - December 2025

Check out the December 2025 Power BI Holiday Recap!

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.