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
DynamicsHS
Helper II
Helper II

How to get the Years & months between two date?

Hi, 

 

I want to be able to calculate length of service based on active workers. I used DATEDIFF([Hire Date],[today],YEAR).

 

This gave me the whole numbers of the year ....but i want it to be able to break down so that if an employee has been with the company for 2 and a half years it will show up as 2.6 rather than just 2 years at the moment. 

 

is this possible?

 

Thanks,

HS

 

 

1 ACCEPTED SOLUTION
ryan_mayu
Super User
Super User

@DynamicsHS 

what about try thsi

DATEDIFF([Hire Date],[today],MONTH) / 12 .





Did I answer your question? Mark my post as a solution!

Proud to be a Super User!




View solution in original post

4 REPLIES 4
jdbuchanan71
Super User
Super User

@DynamicsHS 

You would be very close with 

 

DIVIDE ( DATEDIFF([Hire Date],[today],DAY), 365)

If you want to keep it to 1 decimal do 

ROUND(DIVIDE ( DATEDIFF([Hire Date],[today],DAY), 365),1)

 

ryan_mayu
Super User
Super User

@DynamicsHS 

what about try thsi

DATEDIFF([Hire Date],[today],MONTH) / 12 .





Did I answer your question? Mark my post as a solution!

Proud to be a Super User!




It worked! Thank you

you are welcome





Did I answer your question? Mark my post as a solution!

Proud to be a Super User!




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