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

Compete to become Power BI Data Viz World Champion! First round ends August 18th. Get started.

Reply
ALW0120
New Member

Date Filter to include the previous 6 Days

I am needing to filter my Date Column by a specified date plus the 6 previous days. Screenshot 2025-03-05 105711.png

2 ACCEPTED SOLUTIONS
BeaBF
Super User
Super User

@ALW0120 Hi! which is the specified date? You can adapt the following code:

 

FilteredRows = Table.SelectRows(#"ExtractedDate", each [PlanDate] >= Date.AddDays(DateTime.FixedLocalNow(), -6)
and [PlanDate] <= DateTime.FixedLocalNow())

 

i've used FixedLocalNow, but you can put any date.

 

BBF

 

 

View solution in original post

Omid_Motamedise
Super User
Super User

You can achieve this in Power Query by adding a custom column that checks if the date falls within the specified range. Here’s how:

Define your target date (e.g., #date(2025, 3, 😎 for March 8, 2025).
Create a filter condition to keep dates between the target date and 6 days before it.

 

 

TargetDate = #date(2025, 3, 8), // Change this to your desired date
StartDate = TargetDate - #duration(6,0,0,0),
[Date Column] >= StartDate and [Date Column] <= TargetDate

If my answer helped solve your issue, please consider marking it as the accepted solution. It helps others in the community find answers faster—and keeps the community growing stronger!
You can also check out my YouTube channel for tutorials, tips, and real-world solutions in Power Query with the following link
https://youtube.com/@omidbi?si=96Bo-ZsSwOx0Z36h

View solution in original post

6 REPLIES 6
V-yubandi-msft
Community Support
Community Support

Hi @ALW0120 ,

May I ask if you have resolved this issue? If so, please mark the helpful reply and accept it as the solution. This will be helpful for other community members who have similar problems to solve it faster.

Thank you.

V-yubandi-msft
Community Support
Community Support

Hi @ALW0120 ,

Has your issue been resolved, or do you require any further information? Your feedback is valuable to us. If the solution was effective, please mark it as 'Accepted Solution' to assist other community members experiencing the same issue.

Thank You.

V-yubandi-msft
Community Support
Community Support

Hi @ALW0120 ,

We noticed we haven't received a response from you yet, so we wanted to follow up and ensure the solution we provided addressed your issue. If you require any further assistance or have additional questions, please let us know.

Your feedback is valuable to us, and we look forward to hearing from you soon.

 

Thak You.

Omid_Motamedise
Super User
Super User

You can achieve this in Power Query by adding a custom column that checks if the date falls within the specified range. Here’s how:

Define your target date (e.g., #date(2025, 3, 😎 for March 8, 2025).
Create a filter condition to keep dates between the target date and 6 days before it.

 

 

TargetDate = #date(2025, 3, 8), // Change this to your desired date
StartDate = TargetDate - #duration(6,0,0,0),
[Date Column] >= StartDate and [Date Column] <= TargetDate

If my answer helped solve your issue, please consider marking it as the accepted solution. It helps others in the community find answers faster—and keeps the community growing stronger!
You can also check out my YouTube channel for tutorials, tips, and real-world solutions in Power Query with the following link
https://youtube.com/@omidbi?si=96Bo-ZsSwOx0Z36h
V-yubandi-msft
Community Support
Community Support

Hello @ALW0120 ,

 

Thank you for your valuable input, @BeaBF .

@ALW0120 , BeaBF  has provided an accurate solution to your issue. Could you please confirm if it meets your requirements? If you need any further clarification.

If your issue is resolved, kindly mark it as the Accepted Solution. Otherwise, let us know how we can assist you further.

 

Regards,

Yugandhar.

BeaBF
Super User
Super User

@ALW0120 Hi! which is the specified date? You can adapt the following code:

 

FilteredRows = Table.SelectRows(#"ExtractedDate", each [PlanDate] >= Date.AddDays(DateTime.FixedLocalNow(), -6)
and [PlanDate] <= DateTime.FixedLocalNow())

 

i've used FixedLocalNow, but you can put any date.

 

BBF

 

 

Helpful resources

Announcements
August Power BI Update Carousel

Power BI Monthly Update - August 2025

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

August 2025 community update carousel

Fabric Community Update - August 2025

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

Top Solution Authors