How to Use Power Query Date Functions in Excel (3 Examples)

Consider the dataset below. Some products of an online store, their order, and delivery dates are provided.


Example 1 – Getting the Year, Quarter, Month, and Day

Steps:

  • Click a random cell on the data, go to the Data tab, and then click From Table/Range.

Excel Power Query Date Functions

  • The Create Table dialog box will come up. Click OK.

  • The Power Query Editor window will show up. You will see your dataset in that window. The date has been shown with time here.

  • In the Order Date column, click the icon (clock-calendar icon) at the top-left corner.
  • Select Date from the dropdown.

  • You will see a new pop-up named Change Column Type. Here, click Replace Current.

  • The data type will be changed to Date.

Excel Power Query Date Functions

  • Go to the Add Column tab in the Power Query Editor.
  • You will see the Date. This icon has the desired Date functions.
  • Click the dropdown.

  • In the dropdown list of the Date icon, you will see a couple of functions like Age, Year, Quarter, Month, Week, and Day.
  • To extract the Year from your date, click the drop-right arrow of the Year option, then select Year.

Excel Power Query Date Functions

  • A new column has been inserted mentioning the Year from the date list (i.e. 2020 has been extracted from the date 23-Mar-20).

Excel Power Query Date Functions

  • If you want to get in which Quarter of the concerned year your date exists, go to the Date icon and select Quarter then Quarter of Year.

  • You will see the Quarter column beside the Year.

Excel Power Query Date Functions

  • Repeat the process for extracting the Month.

  • You will get the Month column added beside the previous column.

  • Similarly, get the Day from the date.

Excel Power Query Date Functions

  • Go to the Home tab of the Power Query window and click Close & Load.

  • This command will load the data to the Excel worksheet window.


Example 2 – Finding the Differences Between Two Dates

Consider this dataset. We want to find the difference between the order date and the delivery date.

Steps:

  • Import the data to the Power Query Editor window following the same steps as Method 1.
  • Select the Order Date column and Delivery Date column together by holding the Ctrl key.
  • Go to the Add Column tab and click the dropdown of the Date icon, then select Subtract Days.

  • A new column named Subtraction has been inserted calculating the difference between the two dates.

  • Apply the Close & Load command to load this data to the Excel worksheet.

Excel Power Query Date Functions


Example 3 – Getting the Name of the Day and the Month

Steps:

  • Import the data to the Power Query window.
  • Go to Add Column.
  • Click the drop-down for Date.
  • Select Day and click Name of Day.

  • The Name of the corresponding Date has been inserted beside the Date.

  • Similarly, find the Month name and add a new column named Month Name.

Excel Power Query Date Functions

  • Load the data to the Excel window and you’re done.


Practice Section

We’re providing you with a practice sheet so that you can practice yourself. Try to find out anything you want by applying the Power Query Date functions.


Download the Practice Workbook


<< Go Back to Power Query Excel | Learn Excel

Get FREE Advanced Excel Exercises with Solutions!
Rafiul Hasan
Rafiul Hasan

Rafiul Hasan, holding a BSc in Naval Architecture and Marine Engineering from Bangladesh University of Engineering & Technology, contributes significantly to the ExcelDemy project with almost 1.6 years of dedicated work. Currently an Excel and VBA Content Developer, he has a passion for problem-solving. Authoring over 100 articles for ExcelDemy showcases expertise in Microsoft Office Suites and Data Analysis. In addition to content development, Rafiul actively engages with the ExcelDemy forum, offering valuable solutions to user queries and... Read Full Bio

We will be happy to hear your thoughts

Leave a reply

Advanced Excel Exercises with Solutions PDF

 

 

ExcelDemy
Logo