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

Enhance your career with this limited time 50% discount on Fabric and Power BI exams. Ends August 31st. Request your voucher.

Reply
Anonymous
Not applicable

Creating a Date Table with only months

Hi all,

 

I'm trying to created a date table, where each row is equal to one month, like:

 

January 2023

February 2022

March 2022

 

I've tried a number of methods for this but I can't seem to figure it out. For example, CALANDERAUTO() gives me a row for each day, rather than a row for each month as per below:

 

custerdome_0-1674471978785.png

 

Any help would be greatlly appreciated!

 

Thanks

1 ACCEPTED SOLUTION
Anonymous
Not applicable

Hi @Anonymous 

You can refer to the following example.

Create a new table

Table = var a=ADDCOLUMNS(CALENDAR(DATE(2022,1,1),DATE(2023,1,1)),"Month Year",FORMAT([Date],"yyyy mmmm"))
return SUMMARIZE(a,[Month Year])

 

vxinruzhumsft_0-1674632063923.png

Then change the data type to date, and the format to "mmmm yyyy"

vxinruzhumsft_1-1674632130796.png

 

Best Regards!

Yolo Zhu

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

4 REPLIES 4
Anonymous
Not applicable

Hi @Anonymous 

You can refer to the following example.

Create a new table

Table = var a=ADDCOLUMNS(CALENDAR(DATE(2022,1,1),DATE(2023,1,1)),"Month Year",FORMAT([Date],"yyyy mmmm"))
return SUMMARIZE(a,[Month Year])

 

vxinruzhumsft_0-1674632063923.png

Then change the data type to date, and the format to "mmmm yyyy"

vxinruzhumsft_1-1674632130796.png

 

Best Regards!

Yolo Zhu

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

xh0050515
Advocate I
Advocate I

Hi,

You can create a blank query and paste this code to generate desired results.

Please change the range as per your requirement.

----------------------------------

let
Source = Table.FromRows(Json.Document(Binary.Decompress(Binary.FromText("i45WMtQ31DcyMDRQio0FAA==", BinaryEncoding.Base64), Compression.Deflate)), let _t = ((type nullable text) meta [Serialized.Text = true]) in type table [StartDate = _t]),
#"Changed column type" = Table.TransformColumnTypes(Source, {{"StartDate", type date}}),
#"Added custom" = Table.AddColumn(#"Changed column type", "EndDate", each "12/31/2025"),
#"Changed column type 1" = Table.TransformColumnTypes(#"Added custom", {{"EndDate", type date}}),
#"Added custom 1" = Table.AddColumn(#"Changed column type 1", "Date", each {Number.From([StartDate])..Number.From([EndDate])}),
#"Expanded Date" = Table.ExpandListColumn(#"Added custom 1", "Date"),
#"Changed column type 2" = Table.TransformColumnTypes(#"Expanded Date", {{"Date", type date}}),
#"Removed Columns" = Table.RemoveColumns(#"Changed column type 2",{"StartDate", "EndDate"}),
#"Calculated Start of Month" = Table.TransformColumns(#"Removed Columns",{{"Date", Date.StartOfMonth, type date}}),
#"Removed Duplicates" = Table.Distinct(#"Calculated Start of Month")
in
#"Removed Duplicates"

FreemanZ
Super User
Super User

hi @Anonymous 

try to add a column like this:

MonthYear = FORMAT([Date], "MMMM YYYY")

hi @Anonymous 

or you wanna create a table from scratch, like this:

DateTable = 
ADDCOLUMNS(
    CALENDAR(DATE(2022,12,30), DATE(2023,1,1)),
    "MonthYear", FORMAT([Date], "MMMM YYYY"),
    "MonYear", FORMAT([Date], "MMM YYYY")
)

 

FreemanZ_0-1674472731427.png

Helpful resources

Announcements
July 2025 community update carousel

Fabric Community Update - July 2025

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

July PBI25 Carousel

Power BI Monthly Update - July 2025

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

Join our Fabric User Panel

Join our Fabric User Panel

This is your chance to engage directly with the engineering team behind Fabric and Power BI. Share your experiences and shape the future.