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
jerryr125
Helper IV
Helper IV

Creating Rows -Adding Dates

Hi - I would like to create a row for each month/year from the starting data.

Any help would be appreciated!  Jerry

 

Example:

 

Table01 - input (starting data):

 

ProjectCategory 01Category 02Category Date
A20812-2025
B362412-2025
C604812-2025

 

Final Output:

 

ProjectCategory 01Category 02Category Date
A20812-2025
A20811-2025
A20810-2025
A20809-2025
A20808-2025
A20807-2025
A20806-2025
A20805-2025
A20804-2025
A20803-2025
A20802-2025
A20801-2025
B362412-2025
B362411-2025
B362410-2025
B362409-2025
B362408-2025
B362407-2025
B362406-2025
B362405-2025
B362404-2025
B362403-2025
B362402-2025
B362401-2025
C604812-2025
C604811-2025
C604810-2025
C604809-2025
C604808-2025
C604807-2025
C604806-2025
C604805-2025
C604804-2025
C604803-2025
C604802-2025
C604801-2025

 

 

Current Power Query Structure:

 

jerryr125_0-1739700804170.png

 

Current Advance Editor:

 

let
Source = Excel.CurrentWorkbook(){[Name="Table1"]}[Content],
#"Changed Type" = Table.TransformColumnTypes(Source,{{"Project", type text}, {"Category 01", Int64.Type},
{"Category 02", Int64.Type}, {"Category Date", type date}})
in
#"Changed Type"

 

 

1 ACCEPTED SOLUTION
BA_Pete
Super User
Super User

Hi @jerryr125 ,

 

@speedramps has provided a perfectly good solution already, but I think you'll find this alternative a bit simpler, and it will keep your query a bit cleaner as it's just one step to create the list.

Use the following formula in a new custom column:

List.Distinct(
    List.Transform(
        {Number.From(Date.AddMonths([Category Date], -11))..Number.From([Category Date])},
        each Date.StartOfMonth(Date.From(_))
    )
)

 

Once you expand the resulting list, you get the following output:

BA_Pete_0-1739728809974.png

 

 

Pete



Now accepting Kudos! If my post helped you, why not give it a thumbs-up?

Proud to be a Datanaut!




View solution in original post

3 REPLIES 3
jerryr125
Helper IV
Helper IV

 Thank you everyone  - appreciate it !

BA_Pete
Super User
Super User

Hi @jerryr125 ,

 

@speedramps has provided a perfectly good solution already, but I think you'll find this alternative a bit simpler, and it will keep your query a bit cleaner as it's just one step to create the list.

Use the following formula in a new custom column:

List.Distinct(
    List.Transform(
        {Number.From(Date.AddMonths([Category Date], -11))..Number.From([Category Date])},
        each Date.StartOfMonth(Date.From(_))
    )
)

 

Once you expand the resulting list, you get the following output:

BA_Pete_0-1739728809974.png

 

 

Pete



Now accepting Kudos! If my post helped you, why not give it a thumbs-up?

Proud to be a Datanaut!




speedramps
Super User
Super User

Try this ....

 

In  Power Query add a custom columm

List.Numbers(1,12)

speedramps_0-1739705698331.png

 

Expand the list

speedramps_1-1739705746031.png

 

Add a another custom columm

Text.From(
Text.PadStart(Text.From([Custom]), 2, "0")
)
&
"-"
& 
Text.From(
Date.Year([Category Date])
)

 

speedramps_2-1739705886232.png

 

Remove the old and temporary custom column and rename the new column to Category Date

speedramps_3-1739705970619.png

 

 

Please click thumbs up and accept solution.

Thanks

 

 

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