Forum Discussion

avininpowerbi's avatar
avininpowerbi
Frequent Visitor
3 years ago
Solved

Date difference between today's date and a past date - issues with M language

Hi there !    I dont know where I am going wrong , Plz helpppp!  I am trying to get the following M code exceute , it is going ok for the first condition, but not working for the 2nd condition wher...
  • Anonymous's avatar
    Anonymous
    3 years ago

    Hi avininpowerbi ,

    Please try:

    if [Stage] = "Done" and [Estimated Time] > 0 and [Recorded Time] > 0 
    then [Estimated Time] - [Recorded Time] 
    else if [Stage] = "To-Do" and [Due] < DateTime.Date(DateTime.LocalNow()) 
    then Duration.TotalDays(DateTime.LocalNow() - DateTime.From([Due])) 
    else null

     

    Best Regards,
    Gao

    Community Support Team

     

    If there is any post helps, then please consider Accept it as the solution  to help the other members find it more quickly. If I misunderstand your needs or you still have problems on it, please feel free to let us know. Thanks a lot!

    How to get your questions answered quickly --  How to provide sample data in the Power BI Forum