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

Compete to become Power BI Data Viz World Champion! First round ends August 18th. Get started.

Reply
Nzadeh
Frequent Visitor

Calculating Employees Average Tenure for Each Year

Hello BI Community!

 

I want to calculate employees' average tenure for each year and if possible average tenure for each gender and ethnicity group. I appreciate it if someone could help me with this. Here are the dataset and the pbix file. 

 

pbix: https://drive.google.com/file/d/1P_aQGCShF-tVLIlprMN91yAkm8NS7xot/view?usp=sharing

dataset: https://docs.google.com/spreadsheets/d/1O7TxoapNr6_OA1MKW9l_EGH4DHqKzawL/edit?usp=sharing&ouid=11229...

 

 

 

 

3 REPLIES 3
Anonymous
Not applicable

Hi @Nzadeh ,

 

Have trouble to follow, do you want datediff/years or (sum of tenure/ count of Employees) each year?

 

Best Regards,

Jay

amitchandak
Super User
Super User

@Nzadeh , Try a Meausre like


Avg Stay =
CALCULATE(AVERAGEX(FILTER(Employees,Employees[Hire_Date]<=MAX(Dates[Date]) && (ISBLANK(Employees[Termination_Date]) || Employees[Termination_Date]>MAX(Dates[Date]))), DATEDIFF([Hire_Date],if(ISBLANK(Employees[Termination_Date]) || Employees[Termination_Date]>MAX(Dates[Date]), max('Dates'[Date]),Employees[Termination_Date]), MONTH )))

 

 

Or a column, that will always give based on today or termination date

Tenure = datediff([Hire_Date], COALESCE([Termination_Date], TODAY()),MONTH)

 

and then take avg

 

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

Thank you so much @amitchandak ! I used both of these options, but I got different results. 

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.