📆Power BI: How to Create an Automatic Calendar Table


Ver este post na versão em Português

In this tip I will teach you the easiest way to create the time dimension table dCalendar using the CALENDARAUTO() formula.
I will explain how the formula works and show you a practical and quick example.

Understand the CALENDARAUTO() formula:

CALENDARAUTO() reads the data model, recognizes all values in the date fields and automatically creates the dimension table dCalendar with the required date range.

The table will contain only the date range. You can customize the table, complementing it by inserting fields such as Month, Year, Quarter, etc. I will give you a practical example.

Tip summary:

Create a calendar table automatically and complement it.

Anúncios

Tip / Solution:

Before continue, subscribe, it’s free! Follow on social media

In the left sidebar, select “Data”:

Power BI screen showing where to click to select the Data option

Create a new table in “Table tools” → “New table”:

Power BI screen, showing the Table Tools menu, then the New Table button and the image also shows the DAX CALENDARAUTO function

Insert the code below:

dCalendar = CALENDARAUTO()

The table will be created automatically. Wait a few moments, depending on the size of your data model, it will take a few seconds.

power bi showing the result of the formula to get dcalendar using the DAX CALENDARAUTO formula

Now, we will complement the table. Create a new column under “Table Tools” → “New Column”:

Power BI screen teaching how to Create a new column in “Table tools” → “New Column”

Insert the formula below:

Year = YEAR('dCalendário'[Date])
Power BI formula builder showing how to create new column using DAX YEAR function

Result:

showing the result of the DAX YEAR function in the table created within Power BI

Anúncios

To insert more columns (Month, Quarter, etc.), repeat the process “Table tools” → “New Column”:

Insert the codes below for each column:

Month = MONTH('dCalendar'[Date])
Month text = FORMAT('dCalendar'[Date],"MMMM")
Quarter = QUARTER('dCalendar'[Date])
Day = DAY('dCalendar'[Date])
Halfyear = IF('dCalendar'[Month] <= 6,1,2)
Power BI screen showing the result of the table created with the Month, Quarter, Day and Semester DAX formulas using the codes MONTH, FORMAT, QUARTER, DAY

Ready! Simple and easy! Feel free to customize your dCalendar table according to your requirements.

Keywords: dCalendario; CALENDARAUTO(); CALENDARAUTO; Calendar; Time; Date; MONTH(); YEAR(); QUARTER(); DAY(); create calendar table power bi; power bi calendar; calendar table power bi dax; power bi calendar automatic; MONTH; YEAR; QUARTER; DAY; power bi dcalendar; how to create power bi calendar table using dax; power bi full calendar table; how to create power bi calendar table

Did you like the content? Want to get more tips? Subscribe for free!


Follow on social media:



2 comentários em “📆Power BI: How to Create an Automatic Calendar Table

Deixe um comentário