Power Query: Get Today’s Date

- Written by Puneet

In Power Query, if you want to get today’s date (current date in a column), you need to add a custom column by using two functions together.

Note: Use the formula DateTime.Date( DateTime.LocalNow() ) to get today’s date using power query.

Below are some dates in the Column, and now we need to add a column with today’s date.

Steps to Add a Current Date Column

  1. First, go to the Data Tab > From Other Source > From Table/Range.
    get-today-date-in-power-query
  2. Now in the power query editor, you need to add a new custom column, so go to Add Column > Custom Column.
    in-power-query-ad-custom-column
  3. From here, enter the formula DateTime.Date(DateTime.LocalNow()) and give a name to the new Column in the custom column dialog box.
    enter-date-time-formula
  4. In the end, click OK to add the Column.
    add-new-column-with-formula
=DateTime.Date( DateTime.LocalNow() )

How this Formula Works

In this formula, we have used two functions:

  • The first function (DateTime.LocalNow) returns the current date and time according to the date and time of your system.
  • The second function (DateTime.Date) wrapped around the first one gets the date part from it and returns it as a final value.

Alternate Method

Instead of the above formula, you can use the (DateTime.LocalNow()) in the custom column.

alternate-method-of-getting-today-date

And after that, go to the Home > Data Type and select the  Date from the drop down to convert the Column into the date only.

convert-the-column-into-date-only

It will convert the date and time into date only.

Adding Current Date in a Single Cell

And if you want to have the current date in a single cell, you need open the Power Query editor with a blank editor.

add-current-date-in-single-column

After that, in the editor, enter the below formula in the formula bar and hit enter.

= DateTime.Date( DateTime.LocalNow() )
enter-formula-and-hit-enter

After that, you can convert this date value into a table or a list.

convert-the-date-value-into-table-or-list

Get the Excel File

Download