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

Join the Fabric FabCon Global Hackathon—running virtually through Nov 3. Open to all skill levels. $10,000 in prizes! Register now.

Reply
numersoz
Helper III
Helper III

Filtering Dates on Power Query

Hi,

 

On power query I have timestamp values (Datetime). First of all I want to dynamically filter this and remove any value before today's date. What would be the way to do this?

 

The second part that I want to do is, find the maximum value of these time stamps, convert this datetime to date and later use this to filter my callender table on Power Query so that the maximum value in the callender table is the maximum value in my timestamps.

1 ACCEPTED SOLUTION
edhans
Super User
Super User

  • Create a blank query and type = DateTime.LocalDateNow() in the formula bar.
  • Call it varToday or whatever you want.
  • Then go your table and filter by any date. It will have something like < #date(2020,1,1). Replace that #date(2020,1,1) with varToday and it will always be less than today.

To get the max time stamp into a variable like this do the following:

  • Create a reference to your query. Right-click and make sure it is not set to load
  • Click on teh date field you are interested in and on the Transform menu, select the Date and Latest and it will convert it to a scalar value with List.Max([datevalue])
  • Name this query varWhateverYouWant
  • Use it as a filter the same way.

I always use dynamic date tables this way. See this article - seems to be exactly what you are doing.

Creating a Dynamic Date Table in Power Query



Did I answer your question? Mark my post as a solution!
Did my answers help arrive at a solution? Give it a kudos by clicking the Thumbs Up!

DAX is for Analysis. Power Query is for Data Modeling


Proud to be a Super User!

MCSA: BI Reporting

View solution in original post

1 REPLY 1
edhans
Super User
Super User

  • Create a blank query and type = DateTime.LocalDateNow() in the formula bar.
  • Call it varToday or whatever you want.
  • Then go your table and filter by any date. It will have something like < #date(2020,1,1). Replace that #date(2020,1,1) with varToday and it will always be less than today.

To get the max time stamp into a variable like this do the following:

  • Create a reference to your query. Right-click and make sure it is not set to load
  • Click on teh date field you are interested in and on the Transform menu, select the Date and Latest and it will convert it to a scalar value with List.Max([datevalue])
  • Name this query varWhateverYouWant
  • Use it as a filter the same way.

I always use dynamic date tables this way. See this article - seems to be exactly what you are doing.

Creating a Dynamic Date Table in Power Query



Did I answer your question? Mark my post as a solution!
Did my answers help arrive at a solution? Give it a kudos by clicking the Thumbs Up!

DAX is for Analysis. Power Query is for Data Modeling


Proud to be a Super User!

MCSA: BI Reporting

Helpful resources

Announcements
FabCon Global Hackathon Carousel

FabCon Global Hackathon

Join the Fabric FabCon Global Hackathon—running virtually through Nov 3. Open to all skill levels. $10,000 in prizes!

September Power BI Update Carousel

Power BI Monthly Update - September 2025

Check out the September 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
Top Kudoed Authors