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

Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.

Reply
Anonymous
Not applicable

Power Query - Creating a list of previous days from today's date

Hi, I'm trying to create a dynamic table in Power Query that makes a list of dates from a predetermined date to today. Currently, I have an equation that simply adds a set amount of days to a date. Is there a way for me to write a formula to do that dynamically, given today's date and a given begin date?

 

Conceptually, I want to do something like today() - date, and then insert that value into my forumla before...but I'm too inexperienced with the notation to do it.

 

Important - I need to do this in Query because I am merging a bunch of tables before loading the table.

 

Example Below:

Capture2.PNG

 

 

1 ACCEPTED SOLUTION
AlB
Super User
Super User

HIi @Anonymous 

 

List.Dates(#date(2019,10,01),Number.From(Date.From(DateTime.LocalNow())-#date(2019,10,01))+1,#duration(1,0,0,0))

 

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 

SU18_powerbi_badge

View solution in original post

2 REPLIES 2
AlB
Super User
Super User

HIi @Anonymous 

 

List.Dates(#date(2019,10,01),Number.From(Date.From(DateTime.LocalNow())-#date(2019,10,01))+1,#duration(1,0,0,0))

 

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 

SU18_powerbi_badge

Anonymous
Not applicable

@AlB perfect, thank you.

Helpful resources

Announcements
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

Check out the April 2024 Power BI update to learn about new features.

April Fabric Community Update

Fabric Community Update - April 2024

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