Create Date/ Calendar table

Body

This article provides information on how to create a date/calendar table.

Detailed Information

Whenever a dataset has dates, it is better to create a date dimension table for performance reasons. Here are the steps to crate a date table:

  1. In Power BI Desktop, go to File > Options and settings > Options.

    Showing the Power BI Options menu and highlighting the Auto Date/Time checkbox location.
  2. Under "Data Load", uncheck the box for "Auto date/time" and click "OK.

  3. If you know when the start date and end date for the dataset are, that's good. If not, check the data and find the earliest date and latest date on the dataset. (You can create a simple visual to find those dates.)

  4. Go to the "Modeling" tab and click "New Table." Type Calendar= CALENDAR(DATE(start date with year, month, date), DATE (end date with year, month, date). In the example below, Calendar= CALENDAR(DATE(2010, 01, 01), DATE (2020, 12, 31), was used.

    showing the creation of a new table with the code entered.

  5. Go to the Data pane and click the three dots next to the Calendar table you just created. Then, go to Mark as date: table > Mark as date table.showing the location of the mark as data table button on the more menu for the new calendar table.

  6. Choose "Date" under the "Date column" and click "OK."
    showing an example of the mark as data table pop up window.

  7. Create a new column by right-clicking the field. Type Year = FORMAT('field name, "yyyy").
    showing the location of the New Column button.

  8. You can repeat the same process for the month and day columns. For more FORMAT options, go to https://docs.microsoft.com/en-us/dax/format-function-dax.
        showing an example of the creation of the year, month, and day columns.

  9. Go to the Model pane to create the relationships with the existing table.

INFO: Please note that this process was NOT done in Query Editor (Transform data > Transform data)

Details

Details

Article ID: 159322
Created
Fri 5/10/24 4:54 AM
Modified
Mon 9/15/25 3:07 PM
Applies To
Faculty
Staff