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
luzsoulez
Frequent Visitor

Generate rows for month/year between a range of dates

I need something that gives me just the month and year (it can be the first day of the month or last as long as it is not Saturday or Sunday) to be able to calculate revenue per month. See row 2. I basically need to repeat the 41,044 for every month between Jan 2022 and Dec 2024

luzsoulez_0-1664373816362.png

This is what I tried but it is not working

Table.AddColumn(#"Reordered Columns", "Transaction Date", each List.Select( List.Transform( {Number.From([Start Date])..Number.From([End Date])}, each Date.From(_) ), each Date.EndofMonth(_, 1) ))

 

1 ACCEPTED SOLUTION
ImkeF
Super User
Super User

Hi @luzsoulez ,
please check out the function that I've published here: Date.DatesBetween to retrieve dates between 2 dates in Power BI and Power Query – The BIccountant

 

Imke Feldmann (The BIccountant)

If you liked my solution, please give it a thumbs up. And if I did answer your question, please mark this post as a solution. Thanks!

How to integrate M-code into your solution -- How to get your questions answered quickly -- How to provide sample data -- Check out more PBI- learning resources here -- Performance Tipps for M-queries

View solution in original post

2 REPLIES 2
ImkeF
Super User
Super User

Hi @luzsoulez ,
please check out the function that I've published here: Date.DatesBetween to retrieve dates between 2 dates in Power BI and Power Query – The BIccountant

 

Imke Feldmann (The BIccountant)

If you liked my solution, please give it a thumbs up. And if I did answer your question, please mark this post as a solution. Thanks!

How to integrate M-code into your solution -- How to get your questions answered quickly -- How to provide sample data -- Check out more PBI- learning resources here -- Performance Tipps for M-queries

Thanks that worked! Brilliant 🙂

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.

Top Solution Authors
Top Kudoed Authors