Forum Discussion

atjt217's avatar
atjt217
Helper III
3 years ago
Solved

Subtract Years from Date

Hello PBI Wizards, 

 

Hope you can help me out? I have a column that contains Expiration dates for licenses. I want to be able to add a column that shows the start date. Each license has a validity of 4 years. So basilcally I need to subtract 4 years to the Expiration date. 

 

 

  • You can use this expression to do that.

     

    = Date.AddYears([Expiration Date], -4)

     

    Pat

     

  • Anonymous's avatar
    Anonymous
    3 years ago

    Hi atjt217 ,

    1. The method provided by Pat. To add a custom column in Power Query Eidtor. 

    2. Or new a calculated column:

     

    Start Date = EDATE('Table'[Expiration Date],-48)

     

    I tend to recommend the first method, and if a calculation can be done using both M and DAX, try to use M.

     

    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

3 Replies

  • ppm1's avatar
    ppm1
    Solution Sage

    You can use this expression to do that.

     

    = Date.AddYears([Expiration Date], -4)

     

    Pat

     

  • Anonymous's avatar
    Anonymous
    Not applicable

    Hi atjt217 ,

    1. The method provided by Pat. To add a custom column in Power Query Eidtor. 

    2. Or new a calculated column:

     

    Start Date = EDATE('Table'[Expiration Date],-48)

     

    I tend to recommend the first method, and if a calculation can be done using both M and DAX, try to use M.

     

    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