How to Create a Date Table in Power BI?

When working with dates and making project plans in Power BI, you may encounter scenarios where creating a date table becomes necessary.

There are multiple methods to create or add a date table in Power BI.

In this article, I will explain what is a Power BI Date table and how to create a date table in Power BI desktop. Additionally, I’ll guide you through creating a date table with three different methods. Such as:

  • Create a Power BI Date table using the auto-date time
  • Create a Power BI Date table using DAX
  • Create a Power BI Date table using Power Query
  • Create a Date Hierarchy in Power BI

What is a Power BI Date Table?

In Power BI, a Date Table is a special type of table that contains dates and related information, such as the day of the week, month, quarter, and year.

This table helps in creating visualizations like time series charts, comparisons over time, and other date-related analyses easily and efficiently.

Example:

Imagine you run a small retail store that sells clothing. You want to analyze your sales data to understand your business performance over time and identify trends.

This includes tracking your daily, weekly, and monthly sales, comparing sales performance between different product categories, and analyzing seasonal trends.

Suppose you have a date table and sales data. In that case, you can use Power BI to create visualizations like line charts to track sales over time, bar charts to compare sales between product categories, and slicers to filter data by specific periods.

Now you understand how important a date table is in Power BI.

Check the screenshot below for an example of a date table.

How to Create a Date Table in Power BI

How to Create a Date Table in Power BI?

As I suggested above, we can create a date table in Power BI using three different ways. Let’s discuss it one by one.

1. Power BI Create Date Table Auto Date and Time

One simple and easy way to create a date table in Power BI is by enabling the time intelligence option. Ensure that a date column already exists in your model.

Now, we see how to enable the time intelligence option in Power BI.

1. Open Power BI Desktop, then click File -> Options and Settings -> Options.

Circular dependency on Date table Power BI

2. Click on Current File -> Data Load -> Time Intelligence -> Enable Auto date/time -> click OK button.

Circular dependency on Date table Power BI

Now load the data and make sure that a date column exists in your data.

Here, we have a SharePoint list (2024 Sales Data) that contains below columns with various data types:

ColumnsData Types
DateData and time
ProductSingle line of text
QuantityNumber
PriceCurrency
CustomerSingle line of text
Power BI date table relationships

Load the data by using the “Get Data” option. After that, you will observe the date table in the “Data” pane.

How power bi sum group by multiple columns

This way, you can create a date table in Power BI.

2. Create a Date Table in Power BI using DAX

To create a Date Table in Power BI using DAX, we can use the CALENDAR and CALENDARAUTO functions. Both methods return a table with a single ‘Date‘ column and a list of date values.

I use the CALENDAR function to create a date table in this example.

CALENDAR function Syntax:

CALENDAR(<start_date>, <end_date>)

Where:

  • start_date = Any DAX expression that returns a datetime value.
  • end_date = Any DAX expression that returns a datetime value.

In this example, I Create a Power BI date table from 01 Feb 2024 to 29 Feb 2023. Follow below steps below to achieve this:

1. Open Power BI Desktop. Then click “New table” under the Modeling tab.

How to Create a Date Table from Scratch in Power BI

2. In the formula bar, Put the below DAX expression.

Date Table = CALENDAR(Date(2024,02,01),Date(2024,02,29))

Where:

  • Date Table = This is the name we give to the table we create.
  • CALENDAR() = DAX function generates a table of dates within a specified range.
  • Date(2024,02,01) = This function creates a specific date representing February 1, 2024.
  • Date(2024,02,29) = This function creates another date representing February 29, 2024.
date dimension table power bi dax

3. Navigate to the Table view, where a Date column is added to the Date Table dataset. Check out the screenshot below.

How to get a DATE TABLE easily in Power BI

To add more columns like Year, Month, Quarter, and Day to the Date table, follow the below steps.

1. Click the New Column under the Table tools in the same window.

How to add new column in Power BI

2. Add the below DAX formulas in the formula bar. Click Commit on the left side of the formula bar.

Year = YEAR('Date Table'[Date])

Where:

  • Year = This is the name given to the calculated column.
  • YEAR = This DAX function extracts the year component from a date.
  • (‘Date Table'[Date]) = This specifies the column containing the dates from which we want to extract the year component.
power bi create date table with year

3. Now, you can observe a Year column added to the date table, as the screenshot shows below.

How to Create a Date Table in Microsoft Power BI

Follow the same process described above to add new columns like Month, Quarter, and Day using the following DAX formulas.

Month = FORMAT('Date Table'[Date],"mmmm")
Quater = QUARTER('Date Table'[Date])
Day = DAY('Date Table'[Date])

After that, the date table looks like the screenshot below.

Power bi format date as number

This way, you can create a date table in Power BI using DAX

3. Create Date Table in Power Query Power BI

We can use M-Query language to create a date table in Power Query. Follow the below steps to create this:

1. Open Power BI Desktop. Click Transform data under the Home tab.

Date Table for Power BI using Power Query

2. In the Power Query Editor, click the Home tab -> New Source -> Blank Query.

Create Date Table or Calendar in Power Query M

3. On the right side, give the name of the query. In my case, it’s the PowerQuery Date Table.

how to create a blank query in Power BI

We use the “List.Dates” function to create a “Date Table” in Power Query.

List.Dates(start as date, count as number, step as duration)

4. Enter the below code to create a date table from “2024-02-23” to “2024-03-23.” Then click the commit button.

= List.Dates(
      #date(2024,02,23),
      Number.From(#date(2024,03,23)-#date(2024,02,23)),
      #duration(1,0,0,0))

Where:

  • List.Dates = This M function generates a list of dates within a specified range.
  • #date(2024,02,23) = This specifies the starting date for the list of dates.
  • Number.From(#date(2024,03,23)-#date(2024,02,23)) = This calculates the number of days between two dates and converts it to a number.
  • #duration(1,0,0,0) = This specifies the duration increment for each step in the list, which is one day in this case.
Using Measure with a slicer on Power BI report

5. Now, the date list is created. Check out the screenshot below.

Custom Power BI Date Tables Using Power Query

6. Now, we convert the date list to the table. Click on To Table in the Convert group.

How to convert list into table in Power Query Editor

7. Here, change the name of Column 1 to Date and set the data type to Date using the screenshot below.

Power bi show value as percentage format

Now we see how to add columns like year, month, quarter, week, and day in the Power Query editor.

8. Click on Add Column -> Date. Then, a small dialog box opens; using this dialog box, we add columns. Check out the screenshot below.

Power bi show value as percentage format

9. We add the “Month” column to the Date Table. Select the Date column, then click Add Column -> Date -> Month -> Name of Month.

Use Measure in another Measure

10. After that, you see the month column added to the Power Query Editor.

Creating a simple date table in Power BI

11. We can add year, quarter, and day in the same way (before adding the column, you need to select the date column). Check the screenshot below.

Create Date Table in Power Query Power BI

After that, click “Close & Apply,” You can use the date table in any visual.

Power BI Date Hierarchy

  • Microsoft offers a built-in function in Power BI known as Date Hierarchy.
  • In Power BI, the date hierarchy refers to how dates are organized and structured in a report or visualization.
  • It allows users to easily navigate and analyze data based on different time intervals, such as years, quarters, months, and days.

Power BI Date hierarchy looks like the screenshot below:

How to Create a Date Hierarchy in Power BI

This is the overview of the Date Hierarchy in Power BI.

How to Create a Date Hierarchy in Power BI

Now, I will tell you how to create a date hierarchy in Power BI in simple steps:

I have a Date table in this tutorial that we can utilize for this Power BI tutorial. The Date Table includes columns for Date, Month Name, Year, Quarter, and Day Name.

Date Hierarchy in Power BI

Note:

If you don’t know to create a Power BI date table, no problem. I have written a full tutorial about How to Create a Date Table in Power BI

1. Click the Model view on the left side of the Power BI Desktop.

create a date hierarchy in power bi

2. Right-click on the top highest hierarchy (Year) -> Click on the Create hierarchy.

How can I make Power BI Date hierarchy

3. The year hierarchy is created.

How to Make Date Hierarchy in Power BI

4. Next, we will add the Quarter, Month Name, and Day Name to the Year Hierarchy. To do this, go to the Properties panel -> expand General -> In the Hierarchy field, add the Quarter, Month Name, and Day Name.

How to Create a Custom Date Hierarchy

5. After adding the column, then click Apply Level Changes.

Creating a Date Hierarchy in Power BI

6. Go to the Data panel to see a Year Hierarchy created.

how to create date hierarchy in power bi

7. Double click in the Year Hierarchy and give the name as Data Hierarchy.

Power BI create date hierarchy

This way, we can create a date hierarchy in Power BI Desktop.

How to use Date Hierarchy in Power BI

Now we see how to use date hierarchy in the Power BI Report.

Here, I have a SharePoint list that I am using for this example

ColumnsData Types
Order DateDate and time
RegionSingle line of text
CategorySingle line of text
Sub-CategorySingle line of text
Product NameSingle line of text
SalesCurrency
QuantityNumber
use date hierarchy in power bi

1. Open Power BI Desktop and load the data, then the data set shows in the Data Panel.

In the data set, the Date Hierarchy is automatically created.

automatic date hierarchy power bi

2. Click the Stacked column chart in the Visualization panel, then drag Order Date into the X-axis and Sales into the Y-axis field.

How to use Date Hierarchy in Power BI

Follow the above step to use date hierarchy in Power BI.

How to Remove Date Hierarchy in Power BI

Now we see how to remove the date hierarchy in Power BI.

There’s a Date column in the date table above, and Power BI automatically creates a date hierarchy within that column.

On the left side is a screenshot displaying the date hierarchy. On the right side is the screenshot after removing the date hierarchy how it looks.

auto create date hierarchy in Power BI

To remove auto date hierarchy, follow the below steps:

1. Click File -> Options and Settings -> Options.

remove date hierarchy power bi

2. Click on Current File -> Data Load -> Time Intelligence -> Uncheck the Auto date/time checkbox -> Click OK.

power bi remove date hierarchy

3. Then you see the date hierarchy removed.

Power BI display date without hierarchy

This way, you can remove the date hierarchy in Power BI.

I hope you follow the above steps to create a date table in the power query editor.

Conclusion

I hope you can easily create a date table in Power BI.

In this short tutorial, we learned about date tables in Power BI and various methods to create them, like creating a Power BI date table using auto date time, DAX, and Power query with various scenarios.

Also, you may like some more Power BI tutorials:

>

Build a High-Performance Project Management Site in SharePoint Online

User registration Power Apps canvas app

DOWNLOAD USER REGISTRATION POWER APPS CANVAS APP

Download a fully functional Power Apps Canvas App (with Power Automate): User Registration App

Power Platform Tutorial FREE PDF Download

FREE Power Platform Tutorial PDF

Download 135 Pages FREE PDF on Microsoft Power Platform Tutorial. Learn Now…