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

Earn a 50% discount on the DP-600 certification exam by completing the Fabric 30 Days to Learn It challenge.

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
RTI Forums Carousel3

New forum boards available in Real-Time Intelligence.

Ask questions in Eventhouse and KQL, Eventstream, and Reflex.

MayPowerBICarousel

Fabric Monthly Update - May 2024

Check out the May 2024 Fabric update to learn about new features.

LearnSurvey

Fabric certifications survey

Certification feedback opportunity for the community.