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

Enhance your career with this limited time 50% discount on Fabric and Power BI exams. Ends August 31st. Request your voucher.

Reply
alopez802
New Member

How can I filter the date so that it shows the previous week records?

I want the EngBOMInspDate column to automatically display records that contain dates between a certain date range. So if today is 3/19/2024 it would show the records from 3/5/2024 to 3/12/2024. Another example, if its 3/22/2024, I'd want it to show the records from 3/11/2024/ to 3/15/2024.

 

 

 

alopez802_1-1710857671348.png

 

 

1 ACCEPTED SOLUTION
BA_Pete
Super User
Super User

Hi @alopez802 ,

 

Based on your example, I'm struggling to understand the logic you're going for - your first example is asking for 8 days of data ending 7 days ago, the second example is asking for 5 days of data ending 4 days ago.

The basic structure you need would be something along these lines, but you'll need to adjust to fit your logic or give me some more detail about how you want it to work:

Table.SelectRows(
    PreviousStepName,
    each let __dtToday = Date.From(DateTime.LocalNow()) in
    [EngBOMInspDate] >= Date.AddDays(__dtToday, -14)
    and [EngBOMInspDate] <= Date.AddDays(__dtToday, -7)
)

// Filters a segment of data 7 days in duration, starting from two weeks before today's date.
// Adjust to fit your logic.

 

Pete



Now accepting Kudos! If my post helped you, why not give it a thumbs-up?

Proud to be a Datanaut!




View solution in original post

1 REPLY 1
BA_Pete
Super User
Super User

Hi @alopez802 ,

 

Based on your example, I'm struggling to understand the logic you're going for - your first example is asking for 8 days of data ending 7 days ago, the second example is asking for 5 days of data ending 4 days ago.

The basic structure you need would be something along these lines, but you'll need to adjust to fit your logic or give me some more detail about how you want it to work:

Table.SelectRows(
    PreviousStepName,
    each let __dtToday = Date.From(DateTime.LocalNow()) in
    [EngBOMInspDate] >= Date.AddDays(__dtToday, -14)
    and [EngBOMInspDate] <= Date.AddDays(__dtToday, -7)
)

// Filters a segment of data 7 days in duration, starting from two weeks before today's date.
// Adjust to fit your logic.

 

Pete



Now accepting Kudos! If my post helped you, why not give it a thumbs-up?

Proud to be a Datanaut!




Helpful resources

Announcements
July 2025 community update carousel

Fabric Community Update - July 2025

Find out what's new and trending in the Fabric community.

July PBI25 Carousel

Power BI Monthly Update - July 2025

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