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

Get Fabric Certified for FREE during Fabric Data Days. Don't miss your chance! Request now

Reply
GlassShark1
Helper III
Helper III

Generate a list of dates incrementing by one year

I've been trying to figure out something i'm sure is simple and it's taken me an embarassing amount of time!

All i want to to do generate a list of dates that increment a whole year each time (not 365 days!) when given:

1) A start date

2) An end date

3) The number of dates to produce

 

I thought i could do this with something like the below:

 

List.Dates(#date(2011, 03, 31), 10, #duration(365, 0, 0, 0))


However 365 days is different to a 'year', and all my dates must be "31/03/20XX", with the XX just incrementing by one year each time (31/03/2011, 31/03/2012, 31/03/2013 and so on)

Is there a simple way to do this?

I'll also need to produce a seperate list of the 5 earliest dates within that list too, and maybe remove dates that go beyond a certain threshold - but i'm new to M and struggling a bit so am taking baby steps!


Thanks 🙂

Thanks 🙂 



1 ACCEPTED SOLUTION
mahoneypat
Microsoft Employee
Microsoft Employee

You can do it like this.  Start a blank query with this step.  You can adjust the initial list 0..9 and/or the start date in #date( ).

 

= List.Transform({0..9}, each Date.AddYears(#date(2020,1,1),_))

 

Regards,

Pat





Did I answer your question? Mark my post as a solution! Kudos are also appreciated!

To learn more about Power BI, follow me on Twitter or subscribe on YouTube.


@mahoneypa HoosierBI on YouTube


View solution in original post

4 REPLIES 4
mahoneypat
Microsoft Employee
Microsoft Employee

You can do it like this.  Start a blank query with this step.  You can adjust the initial list 0..9 and/or the start date in #date( ).

 

= List.Transform({0..9}, each Date.AddYears(#date(2020,1,1),_))

 

Regards,

Pat





Did I answer your question? Mark my post as a solution! Kudos are also appreciated!

To learn more about Power BI, follow me on Twitter or subscribe on YouTube.


@mahoneypa HoosierBI on YouTube


Excellent! Thanks 🙂

amitchandak
Super User
Super User

@GlassShark1 , Can Date.AddYears help?

https://docs.microsoft.com/en-us/powerquery-m/date-addyears

Share with Power BI Enthusiasts: Full Power BI Video (20 Hours) YouTube
Microsoft Fabric Series 60+ Videos YouTube
Microsoft Fabric Hindi End to End YouTube

I looked at that, but it seems to be for a single year - i couldn't get it to generate a list of years.

Helpful resources

Announcements
November Power BI Update Carousel

Power BI Monthly Update - November 2025

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

Fabric Data Days Carousel

Fabric Data Days

Advance your Data & AI career with 50 days of live learning, contests, hands-on challenges, study groups & certifications and more!

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