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

Join us for an expert-led overview of the tools and concepts you'll need to become a Certified Power BI Data Analyst and pass exam PL-300. Register now.

Reply
attaalla
New Member

How to make a filter on date dynamic based on a specific start date and a dynamic yesterday

hello, community,

i am stuck in how to change the filter on date column in power query to a dynamic end point.
i connected my source to a website  & i want my report to bring data based on a specific start point & a dynamic yesterday based on local time.

for more simplification:

= Table.SelectRows(#"Reordered Columns", each [Date] >= #date(2023, 1, 1) and [Date] <= #date(2023, 2, 28))

 

i want to change [Date] <= #date(2023, 2, 28) to a dynamic end point refers to yesterday based on my local time.

thanks in advance

1 ACCEPTED SOLUTION

hi @attaalla 

try like:

[Date] <= Date.AddDays(DateTime.Date(DateTime.LocalNow ()),-1)

View solution in original post

4 REPLIES 4
attaalla
New Member

@FreemanZ 

your support is highly appreciated.
 it worked fine now

FreemanZ
Super User
Super User

hi @attaalla 

try like:

[Date] <= Date.AddDays(DateTime.LocalNow (),-1)

@FreemanZ 
thanks for reaching out.
however, there is an issue with the time formating i think.

error.jpg

hi @attaalla 

try like:

[Date] <= Date.AddDays(DateTime.Date(DateTime.LocalNow ()),-1)

Helpful resources

Announcements
Join our Fabric User Panel

Join our Fabric User Panel

This is your chance to engage directly with the engineering team behind Fabric and Power BI. Share your experiences and shape the future.

June 2025 Power BI Update Carousel

Power BI Monthly Update - June 2025

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

June 2025 community update carousel

Fabric Community Update - June 2025

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