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
randomfluky1
New Member

Power Query Dax Date Help

HI,

 

I'm a beginner at Power BI and I'm not so good at Dax.

 

I am trying to create a custom column where it states whether someone is a leaver from 6 years ago or not. 

 

Everything I try is wrong!

 

if [leavedate] = <= DateTime.Date(DateTime.LocalNow())-6  then "Legacy Leaver" else "null")

 

Any suggestions?

 

1 ACCEPTED SOLUTION
Bifinity_75
Solution Sage
Solution Sage

Hi @randomfluky1 , you need to create this formule in Power Query (add a Custom Column):

if Duration.TotalDays((DateTime.Date(DateTime.LocalNow())-[leavedate])/365)>=6 then "Legacy Leaver" else "null"

 

The result:

Bifinity_75_0-1668024112582.png

 

Best Regards

 

View solution in original post

2 REPLIES 2
randomfluky1
New Member

Thank you

Bifinity_75
Solution Sage
Solution Sage

Hi @randomfluky1 , you need to create this formule in Power Query (add a Custom Column):

if Duration.TotalDays((DateTime.Date(DateTime.LocalNow())-[leavedate])/365)>=6 then "Legacy Leaver" else "null"

 

The result:

Bifinity_75_0-1668024112582.png

 

Best Regards

 

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.