cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Highlighted
student1205 Frequent Visitor
Frequent Visitor

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

1 ACCEPTED SOLUTION

Accepted Solutions
Super User
Super User

Re: keep rows with dates older than

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

 

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

Did I answer your question? Mark my post as a solution!

Proud to be a Datanaut!

Imke Feldmann

How to integrate M-code into your solution -- Check out more PBI- learning resources here -- Performance Tipps for M-queries




3 REPLIES 3
Super User
Super User

Re: keep rows with dates older than

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.


Did I answer your question? Mark my post as a solution!

Proud to be a Datanaut!


student1205 Frequent Visitor
Frequent Visitor

Re: keep rows with dates older than

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?

Super User
Super User

Re: keep rows with dates older than

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

 

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

Did I answer your question? Mark my post as a solution!

Proud to be a Datanaut!

Imke Feldmann

How to integrate M-code into your solution -- Check out more PBI- learning resources here -- Performance Tipps for M-queries