Forum Discussion

randomfluky1's avatar
randomfluky1
New Member
3 years ago
Solved

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?

 

  • 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:

     

    Best Regards

     

2 Replies

  • 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:

     

    Best Regards