Power BI: create an automatically updated calendar
The year of this calendar will be updated automatically, it is quite useful so there is no need to change it manually every year. The calendar can be the last 12 months, or between another and current year. To do that, I will create a calculated table (DAX table) by going to the “data view” then select “new table”:
Put this formula:
var FullCalendar = ADDCOLUMNS(CALENDAR(YEAR(NOW())-1&"/1/1",YEAR(NOW())&"/12/31"),"calendar",[Date]) return SUMMARIZE(FullCalendar,[calendar])
It will create a daily calendar:
- from the full last year: YEAR(NOW())-1
- to the full current year: YEAR(NOW())
NOTE: for more past years, change “-1” by another number
In the picture, I changed the table name from “table” to “calendar”:
I can add new columns by clicking on “new column” to display those following information by using those formula:
- To know if it is a leap year: IF(MONTH(DATE(YEAR([argument]),2,29))=2,TRUE,FALSE)

- For the day: WEEKDAY([argument])

NOTE:
- It starts on Sunday and the result is 1 (Sunday), 2 (Monday), 3 (Tuesday), etc.
- To start on Monday so the result is 1 (Monday), 2 (Tuesday), 3 (Wednesday), etc.: WEEKDAY([argument],2)
- For the week: WEEKNUM([argument],1)

NOTE:
- The result will be 1, 2, 3, etc. to show W1, W2, W3, etc.: "W"&WEEKNUM([argument],1)
- The result will be 1, 2, 3, etc. to show W01, W02, W03, etc.: IF(WEEKNUM([argument],1)<10,"W0"&WEEKNUM([argument],1),"W"&WEEKNUM([argument],1))
- 1 assume weeks begin on Sunday, to start another day, see below
- The result will be 1, 2, 3, etc. to show W1, W2, W3, etc.: "W"&WEEKNUM([argument],1)
- For the month: FORMAT([argument],"MMMM")

NOTE:
- For the short month name, put MMM (3 Ms instead of 4 Ms)
- To get the month in number, either use the “data type” to convert it or use this formula: MONTH([argument])
- To get the name of the current month: FORMAT(NOW(),"MMMM")
- To get the name of the previous or next month (change -1 by +1): FORMAT(DATE(1,MONTH(NOW())-1,1),"MMMM")
- For the quarter: FORMAT([argument],"Q")

NOTE:
- To show Q1, Q2, Q3 and Q4, change Q by \QQ
- To get the quarter in number, either use the “data type” to convert it or use this formula: QUARTER([argument])
- For the year: FORMAT([argument],"YYYY")

NOTE:
- The result will be in text format and for the short year, put YY
- To get the result in number, either use the “data type” to convert it or use this formula: YEAR([argument])
NOTE:
- Change “argument” by the name of your column
- You can combine, for instance FORMAT([argument],"YYYY-MM")
The other option is to put what I need in my calendar formula:
To create a weekly calendar:
var FullCalendar = ADDCOLUMNS(CALENDAR(YEAR(NOW())-1&"/1/1",YEAR(NOW())&"/12/31"),"calendar",FORMAT([Date],"YYYY-MM"),"week",WEEKNUM([Date],1)) return SUMMARIZE(FullCalendar,[calendar],[week])
Once done, select the “calendar” column and in “data type”, change “text” to “date”:
![]() |
![]() |
To create a monthly calendar:
var FullCalendar = ADDCOLUMNS(CALENDAR(YEAR(NOW())-1&"/1/1",YEAR(NOW())&"/12/31"),"calendar",FORMAT([Date],"YYYY MM")) return SUMMARIZE(FullCalendar,[calendar])
As for the weekly one, select the “calendar” column and in “data type”, change “text” to “date”. If I want to show only the last 12 months, I will use this formula:
var FullCalendar = ADDCOLUMNS(CALENDAR(YEAR(NOW())-1&"/"&MONTH(NOW())&"/"&DAY(NOW()),YEAR(NOW())&"/"&MONTH(NOW())&"/"&DAY(NOW())),"calendar",[Date],"month",FORMAT([Date],"YYYY-MM")) return SUMMARIZE(FullCalendar,[calendar],[month])
When I will create a chart, I just have to configure the filter like that:
Don’t forget to click on “apply filter” to apply the change.
Interesting Topics
-
Be successfully certified ITIL 4 Managing Professional
Study, study and study, I couldn’t be successfully certified without studying it, if you are interested...
-
Be successfully certified ITIL 4 Strategic Leader
With my ITIL 4 Managing Professional certification (ITIL MP) in the pocket, it was time to go for the...
-
Hide visual and change background color based on selection
Some small tricks to customize the background colour of a text box...
-
Stacked and clustered column chart or double stacked column chart
In excel, I use a lot the combination of clustered and stacked chart...
-
Refresh Power BI
From the Power BI Service, I can set refresh but, for instance, there is no option to do it monthly or each time a change is made...
-
Power BI alerts to be sent by email from an excel file based on condition
I will explain how to send a list of emails from an excel file after creating alerts...








