Forum Discussion

Anonymous's avatar
Anonymous
Not applicable
3 years ago
Solved

DAX Formula Help

I am trying to figure out how to subtract a number from a date. For further context, I have a "Lead-Time" column and I have a "Expiration Date" column. Lead-Time is a whole number and expiration date is a date. I need to subtract the number of days that is my lead time from the expiration date. So if the lead time is ten days and the expiration date is 9/18/22, I need the new column to populate with the date 9/8/22. Is there a way to do this using DAX?

 

Thanks in advance!

  • truptis's avatar
    truptis
    3 years ago

    Yes Anonymous , you can change the interval dynamically. Try this:
    Result = DATEADD([Expiration Date].[date], lead-time, DAY)

4 Replies

  • truptis's avatar
    truptis
    Community Champion

    Hi Anonymous ,
    Try using DATEADD() 
    Eg- Result = DATEADD([Expiration Date].[date], -10, DAY)

    Anonymous -> Please hit the thumbs up & mark it as a solution if it helps you. Thanks.

    • Anonymous's avatar
      Anonymous
      Not applicable

      Is there a way to put the column in the second array instead of the number? otherwise it would all be manual

       

      • truptis's avatar
        truptis
        Community Champion

        Yes Anonymous , you can change the interval dynamically. Try this:
        Result = DATEADD([Expiration Date].[date], lead-time, DAY)