March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount! Early bird discount ends December 31.
Register NowBe one of the first to start using Fabric Databases. View on-demand sessions with database experts and the Microsoft product team to learn just how easy it is to get started. Watch now
Hello,
I want to filter in a table in POWER QUERY the date column to have only the data of the last 14 days.
I have tried to put the following:
= Table.SelectRows (_Data_sales, each [Date_Invoice]> = # DDateTime.LocalNow () - 14)
but it gives me error.
Solved! Go to Solution.
Looks like your column in in DateTime format. Let's convert it then. Try this:
= Table.SelectRows (_Data_sales, each Number.From(Date.From(DateTime.LocalNow()) - Date.From([Date_Invoice])) <=14 )
Please mark the question solved when done and consider giving kudos if posts are helpful.
Contact me privately for support with any larger-scale BI needs, tutoring, etc.
Cheers
Hi @yousseftb
It always helps to paste here the exact error message you get. Try this:
= Table.SelectRows (_Data_sales, each Number.From(Date.From(DateTime.LocalNow()) - [Date_Invoice]) <=14 )
Please mark the question solved when done and consider giving kudos if posts are helpful.
Contact me privately for support with any larger-scale BI needs, tutoring, etc.
Cheers
Helo, many tanks for your message.
When I put your code I get this error:
Expression.Error: We cannot apply operator - to types Date and DateTime.
Details:
Operator=-
Left=05/06/2020
Right=07/01/2019 00:00:00
any suggestion ?
Looks like your column in in DateTime format. Let's convert it then. Try this:
= Table.SelectRows (_Data_sales, each Number.From(Date.From(DateTime.LocalNow()) - Date.From([Date_Invoice])) <=14 )
Please mark the question solved when done and consider giving kudos if posts are helpful.
Contact me privately for support with any larger-scale BI needs, tutoring, etc.
Cheers
Many thanks, it s work
March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount!
Arun Ulag shares exciting details about the Microsoft Fabric Conference 2025, which will be held in Las Vegas, NV.