Power BI is turning 10! Tune in for a special live episode on July 24 with behind-the-scenes stories, product evolution highlights, and a sneak peek at what’s in store for the future.
Save the dateEnhance your career with this limited time 50% discount on Fabric and Power BI exams. Ends August 31st. Request your voucher.
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:
Any help would be greatlly appreciated!
Thanks
Solved! Go to Solution.
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])
Then change the data type to date, and the format to "mmmm yyyy"
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.
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])
Then change the data type to date, and the format to "mmmm yyyy"
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.
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"
hi @Anonymous
try to add a column like this:
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")
)
Check out the July 2025 Power BI update to learn about new features.
User | Count |
---|---|
23 | |
8 | |
7 | |
6 | |
6 |
User | Count |
---|---|
28 | |
12 | |
10 | |
10 | |
6 |