Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

Get Fabric Certified for FREE during Fabric Data Days. Don't miss your chance! Learn more

Reply
JChris
Helper II
Helper II

How to use "Filter Rows" for a Date column to filter $Today - 30 days?

I have a Folder Source with a bunch of CSVs that goes into this folder automatically, but inside Power BI I just want to load the newest CSVs, where newsest = Today - 30 days. How can I do that? The column Date corresponds to the "Creation date" of the CSV.

1 ACCEPTED SOLUTION

Nice, using your answer as foundation, I found an even easier solution:

 

Capture.PNG

 

#"Filtered Rows" = Table.SelectRows(Source, each Date.IsInPreviousNDays([Date created], 30) or Date.IsInCurrentDay([Date created]))

 

View solution in original post

4 REPLIES 4
Datatouille
Solution Sage
Solution Sage

Hi,

 

You need to load all the CSVs which are created within the last 30 days.

 

Or only one CSV which has been created exactly 30 days before Today ?

The folder will have all the CSVs since forever, but inside Power BI I just want to load and work with the CSVs which were created inside the frame "today - 30 days".

 

Capture.PNG

 

2.PNG

 

This is where I can filter, but I don't know how to express "today - 30 days" or something with the same effect in there.

You could use the 'is in the previous' menu with 30 days as a parameter. This will however not consider the csv of 'Today'.

 

Copy paste this code in the advanced editor (M) and adapt it to your need (update the source path).

 

let
Source = Folder.Files("YourSourcePath"),
DatesFlag = Table.AddColumn(Source, "Flag", each [Date created] <= DateTime.LocalNow() and [Date created] >= Date.AddDays(DateTime.LocalNow(),-30)),
KeepLast30Days = Table.SelectRows(DatesFlag, each ([Flag] = true))
in
KeepLast30Days

You can then peacefully combine the binaries (Column 'Content').

 

Nice, using your answer as foundation, I found an even easier solution:

 

Capture.PNG

 

#"Filtered Rows" = Table.SelectRows(Source, each Date.IsInPreviousNDays([Date created], 30) or Date.IsInCurrentDay([Date created]))

 

Helpful resources

Announcements
Fabric Data Days Carousel

Fabric Data Days

Advance your Data & AI career with 50 days of live learning, contests, hands-on challenges, study groups & certifications and more!

October Power BI Update Carousel

Power BI Monthly Update - October 2025

Check out the October 2025 Power BI update to learn about new features.

FabCon Atlanta 2026 carousel

FabCon Atlanta 2026

Join us at FabCon Atlanta, March 16-20, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.

Top Solution Authors