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

Enhance your career with this limited time 50% discount on Fabric and Power BI exams. Ends August 31st. Request your voucher.

Reply
Anonymous
Not applicable

How to set a date range

Hi, 

I hope someone can help me to solve this. I want to set a date range since 2024-01-01 to current date. I tried with this code but it doesn´t work. 

= Table.SelectRows(ConjuntoDeDatosConFaseTemporalDeLaAsignación_table, each [Día] >= #datetime(2024, 1, 1, 0, 0, 0) and [Día] <= #datetime(Date.Year(DateTime.Date), Date.Month(DateTime.Date), Date.Day(DateTime.Date), 0, 0, 0))

 

The code in blue works.

= Table.SelectRows(ConjuntoDeDatosConFaseTemporalDeLaAsignación_table, each [Día] >= #datetime(2024, 1, 1, 0, 0, 0) and [Día] <= #datetime(2025, 01, 10, 0, 0, 0))

 

Thanks.

1 ACCEPTED SOLUTION
DataInsights
Super User
Super User

@Anonymous,

 

Try replacing the code in red with this:

 

DateTime.LocalNow()

 





Did I answer your question? Mark my post as a solution!

Proud to be a Super User!




View solution in original post

5 REPLIES 5
v-sgandrathi
Community Support
Community Support

Hi @Anonymous,
Thank you for reaching out to the Microsoft Fabric Community forum.

 

I wanted to check in on your situation regarding the issue. Have you resolved it? If you have, please consider marking the reply that helped you or sharing your solution. It would be greatly appreciated by others in the community who may have the same question.

 

If you have any further questions or updates regarding your issue, feel free to ask, and we will look into that.

 

Regards,
Sahasra.

Hi @Anonymous,

 

I wanted to follow up on our previous suggestions regarding the issue. We would love to hear back from you to ensure we can assist you further.

If my response has addressed your query, please accept it as a solution and give a ‘Kudos’ so other members can easily find it. Please let us know if there’s anything else we can do to help.

 

Thank you for being a part of the Microsoft Fabric Community.

Omid_Motamedise
Super User
Super User

Use this formula

 

= List.Dates(#date(2024,1,1),Number.From(Date.From(DateTime.LocalNow())- #date(2024,1,1))+1,Duration.From(1))

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
DataInsights
Super User
Super User

@Anonymous,

 

Try replacing the code in red with this:

 

DateTime.LocalNow()

 





Did I answer your question? Mark my post as a solution!

Proud to be a Super User!




@Anonymous,

 

Does your date field have a time portion? It may be simpler to use a date rather than a datetime:

 

DateTime.Date(DateTime.LocalNow())

 





Did I answer your question? Mark my post as a solution!

Proud to be a Super User!




Helpful resources

Announcements
July PBI25 Carousel

Power BI Monthly Update - July 2025

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

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 community update carousel

Fabric Community Update - June 2025

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