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

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now! Learn more

Reply
CincyKJ
Frequent Visitor

Need to Insert Rows for Months between two respective Months listed in the same Date column

Hello Power Query Community!  🙂

 

Below is a graphic of my current Power Query challenge in Excel:

CincyKJ_1-1718309925469.png

 

In my current "Before" table, I have a list of 4 Effective Dates (listed as the first day of the month) and respective Rates.

 

In my desired "After" table, however, I need to use Power Query to:

  a) Insert a row for each month between the Effective Dates in my current table and through the current month (June 2024)

  b) Drop the respective rates accordingly to the above, newly-inserted rows through the current month

 

CincyKJ_2-1718310253209.png

 

CincyKJ_4-1718310295079.png

The table of historical rate data I need to apply the above challenge to is fairly huge (56K rows) and I'm seeking the most efficient means possible to create my "after" table.  (or, should that be, "happily ever after" table?)

 

Any help/guidance/suggestions you could provide me would be GREATLY appreciated... and I THANK You in advance.

 

Respectfully, CincyKJ

 

 

2 ACCEPTED SOLUTIONS
Anonymous
Not applicable

Hi @CincyKJ ,

I suggest you add a calendar table like this one:

vjunyantmsft_0-1718328113914.png

In the Power Query, choose the Before Table, and select Merge Queries:

vjunyantmsft_2-1718328579816.png

vjunyantmsft_3-1718328673176.png

vjunyantmsft_4-1718328711084.png

vjunyantmsft_5-1718328771176.png
Choose column Rate and choose fill down:

vjunyantmsft_6-1718328982185.png

And the final output is as below:

vjunyantmsft_7-1718329073504.png

let
    Source = Table.FromRows(Json.Document(Binary.Decompress(Binary.FromText("i45WMtQ31DcyMDJW0lEyVYrViVYyQQiYgQUMDRAi5hARiIAJUMBCKTYWAA==", BinaryEncoding.Base64), Compression.Deflate)), let _t = ((type nullable text) meta [Serialized.Text = true]) in type table [#"Effective Date" = _t, Rate = _t]),
    #"Changed Type" = Table.TransformColumnTypes(Source,{{"Effective Date", type date}, {"Rate", Int64.Type}}),
    #"Merged Queries" = Table.NestedJoin(#"Changed Type", {"Effective Date"}, Calendar, {"Date"}, "Calendar", JoinKind.FullOuter),
    #"Expanded Calendar" = Table.ExpandTableColumn(#"Merged Queries", "Calendar", {"Date"}, {"Date"}),
    #"Sorted Rows" = Table.Sort(#"Expanded Calendar",{{"Date", Order.Ascending}}),
    #"Filled Down" = Table.FillDown(#"Sorted Rows",{"Rate"})
in
    #"Filled Down"


Best Regards,
Dino Tao
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

View solution in original post

Hi Dino Tao.

 

Thank you ever so much.  "Merging Calendars" worked perfectly for me!

View solution in original post

2 REPLIES 2
Anonymous
Not applicable

Hi @CincyKJ ,

I suggest you add a calendar table like this one:

vjunyantmsft_0-1718328113914.png

In the Power Query, choose the Before Table, and select Merge Queries:

vjunyantmsft_2-1718328579816.png

vjunyantmsft_3-1718328673176.png

vjunyantmsft_4-1718328711084.png

vjunyantmsft_5-1718328771176.png
Choose column Rate and choose fill down:

vjunyantmsft_6-1718328982185.png

And the final output is as below:

vjunyantmsft_7-1718329073504.png

let
    Source = Table.FromRows(Json.Document(Binary.Decompress(Binary.FromText("i45WMtQ31DcyMDJW0lEyVYrViVYyQQiYgQUMDRAi5hARiIAJUMBCKTYWAA==", BinaryEncoding.Base64), Compression.Deflate)), let _t = ((type nullable text) meta [Serialized.Text = true]) in type table [#"Effective Date" = _t, Rate = _t]),
    #"Changed Type" = Table.TransformColumnTypes(Source,{{"Effective Date", type date}, {"Rate", Int64.Type}}),
    #"Merged Queries" = Table.NestedJoin(#"Changed Type", {"Effective Date"}, Calendar, {"Date"}, "Calendar", JoinKind.FullOuter),
    #"Expanded Calendar" = Table.ExpandTableColumn(#"Merged Queries", "Calendar", {"Date"}, {"Date"}),
    #"Sorted Rows" = Table.Sort(#"Expanded Calendar",{{"Date", Order.Ascending}}),
    #"Filled Down" = Table.FillDown(#"Sorted Rows",{"Rate"})
in
    #"Filled Down"


Best Regards,
Dino Tao
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

Hi Dino Tao.

 

Thank you ever so much.  "Merging Calendars" worked perfectly for me!

Helpful resources

Announcements
Power BI DataViz World Championships

Power BI Dataviz World Championships

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now!

December 2025 Power BI Update Carousel

Power BI Monthly Update - December 2025

Check out the December 2025 Power BI Holiday Recap!

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