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

Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.

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
v-jayw-msft
Community Support
Community Support

Hi @Nzadeh ,

 

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

 

Best Regards,

Jay

Community Support Team _ Jay
If this post helps, then please consider Accept it as the solution
to help the other members find it.
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

 

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

Helpful resources

Announcements
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

Check out the April 2024 Power BI update to learn about new features.

April Fabric Community Update

Fabric Community Update - April 2024

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

Top Solution Authors