Forum Discussion

Anonymous's avatar
Anonymous
Not applicable
7 years ago
Solved

keep rows with dates older than

Hi,

I'm currently working on a report to show aged inventory and I want to only keep rows where the date is older than 3 days. There is a date filter to keep rows in the past n days but how do I remove rows in the past n days using M or DAX?

Thank you

  • ImkeF's avatar
    ImkeF
    7 years ago

    That's not as straigthforward as one would hope, unfortunatly:

     

    Date.From(DateTime.LocalNow()) - [Date]

3 Replies

  • Greg_Deckler's avatar
    Greg_Deckler
    Community Champion

    You can create a "DaysAgo" column very easily with something like: TODAY() - [Date] and then filter to <=3. For the M, I'm sure ImkeF knows how to do that.

    • Anonymous's avatar
      Anonymous
      Not applicable

      Can you help me with a formula to add a custom column which returns the number of days between the [Date] column and the current date?

      • ImkeF's avatar
        ImkeF
        Community Champion

        That's not as straigthforward as one would hope, unfortunatly:

         

        Date.From(DateTime.LocalNow()) - [Date]