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
Anonymous
Not applicable

Upcoming 3 employee 3 anniversary day dax

Hi Power BI team,

Below is my data , I need Upcoming 3 employee Anniversary list required.

Depart NameEmployee NameJoingDate
AAA25-09-2018
AAB25-09-2019
AAC01-09-2019
AAD01-09-2017
AAE01-09-2015
AAF11-12-2014
AAG01-01-2019

 

Below is my expected output.

please help me how write DAX

 

Depart NameEmployee NameJoingDateupcoming 3  anniversary
AAA25-09-20182 YEAR 
AAB25-09-20191 YEAR
AAF11-12-2014

5 YEAR 9 MONTH

 

1 ACCEPTED SOLUTION
v-jayw-msft
Community Support
Community Support

Hi @Anonymous ,

 

Check the measure below.

Column = 
var diffmonth = DATEDIFF('Table'[JoingDate],TODAY(),MONTH)
var year = ROUNDDOWN(diffmonth/12,0)
var month = MOD(diffmonth,12)-1
return
IF(month=0,year&" year",year&" year "&month&" month")

1.PNG

Not sure why there's only 3 rows in your expected out put, could you show the logic?

 

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.

View solution in original post

2 REPLIES 2
v-jayw-msft
Community Support
Community Support

Hi @Anonymous ,

 

Check the measure below.

Column = 
var diffmonth = DATEDIFF('Table'[JoingDate],TODAY(),MONTH)
var year = ROUNDDOWN(diffmonth/12,0)
var month = MOD(diffmonth,12)-1
return
IF(month=0,year&" year",year&" year "&month&" month")

1.PNG

Not sure why there's only 3 rows in your expected out put, could you show the logic?

 

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

@Anonymous , Try a measure like

 

calculate(datediff(max(Table[JoingDate]),today(),month), filter(Table, format(Table[JoingDate],"mmddd") >= format(today(),"mmddd")))

 

This will give in month, You can convert to year and month

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.