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




View solution in original post

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.


I have book! Learn Power BI from Packt


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




View solution in original post

Helpful resources

Announcements
Can You Solve These Challenge

Challenge: Can You Solve These?

Find out how to participate in the first Power BI 'Can You Solve These?' challenge.

Community News & Announcements

Community News & Announcements

Get your latest community news and announcements.

Virtual Launch Event

Microsoft Business Applications October Virtual Launch Event

Join us for an in-depth look at the new innovations across Dynamics 365 and the Microsoft Power Platform.

Community Kudopalooza

Win Power BI Swag with Community Kudopalooza!

Each week, complete activities and be qualified in the drawing for cool Power BI Swag.

Users Online
Currently online: 281 members 3,075 guests
Please welcome our newest community members: