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

July 28 - August 9 | Final Round of the Power BI Dataviz World Championships. This is your chance. Learn more

Reply
cosmicyes
Helper II
Helper II

Filter in PowerQuery dates <= today

I need to filter a table in PowerQuery for dates <= today.
As I have learned already this cannot be done within a wizard or so but must be done in M-Code.
I already have seen this thread:

Solved: Power Query Current Date Filter - Microsoft Power BI Community

This seemed to be the solution

let    
    #"Gefilterte Zeilen1" = Table.SelectRows(#"Gefilterte Zeilen", each [Nächster Termin] <= DateTime.LocalNow())
in
    #"Gefilterte Zeilen1"

 

but then I get this error message:

cosmicyes_0-1662023777480.png

Sorry - this is German.
But it is saying that < cannot be used for DateTime and Date.

 

What can I do?

 

1 ACCEPTED SOLUTION
KT_Bsmart2gethe
Impactful Individual
Impactful Individual

Hi @cosmicyes ,

 

The data format are different. DateTime.LocalNow() return DateTime where your column data type is Date.

 

You can define the column to datetime before you apply filter to rows; or you can date Date.From() Date.From(DateTime.LocalNow())

 

Regards

KT

View solution in original post

2 REPLIES 2
KT_Bsmart2gethe
Impactful Individual
Impactful Individual

Hi @cosmicyes ,

 

The data format are different. DateTime.LocalNow() return DateTime where your column data type is Date.

 

You can define the column to datetime before you apply filter to rows; or you can date Date.From() Date.From(DateTime.LocalNow())

 

Regards

KT

Hi @KT_Bsmart2gethe 

 

Life can be so easy if you know what you are doing 🙂
Worked - thanks a lot!

Helpful resources

Announcements
FabCon and SQLCon Barcelona 2026

FabCon & SQLCon – Barcelona 2026

Join us in Barcelona for FabCon and SQLCon, the Fabric, Power BI, SQL, and AI community event. Save €200 with code FABCMTY200.

Fabric Community Sticker Design Challenge Barcelona Carousel

Fabric Community Sticker Challenge - Barcelona 2026

If you love stickers, then you will definitely want to check out our community sticker challenge, Barcelona edition!

July Power BI Update Carousel

Power BI Monthly Update - July 2026

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

Power BI DataViz World Championships carousel

Power BI DataViz World Championships - June 2026

A new Power BI DataViz World Championship is coming this June! Don't miss out on submitting your entry.