The Today Function [DAX’s Functions]

The Today function in DAX is a very useful when working on date-related data.

It is a volatile function that updates or refreshes every time there is a workbook change to return the current date.

Description of the Today Function

The Today function returns your current system date in the format Month, Date, Year by default. This is the American way of showing dates.

The sequence can be changed or customized to your preferred format.

The Today function in DAX returns the current date with a default time of 12:00:00 AM only for all dates.

It is only the date that is updated by the Today function.

power-bi-promo-2

Syntax of the Today Function

The syntax of the Today function is very simple.

The Today function does not even require an argument.

You type the function name with an open and close parenthesis and that’s it.

 

The syntax of the Today function is very simple.

 

power-bi-promo-1

Examples of the Today Function in Use

1.Using Today() to return the current date.

Click on the Home tab (#1), New Measure (#2).

 

Examples of the Today Function in Use

 

OR from the Fields tab (#1), right-click on your preferred table, and select New Measure (#2). See below.

 

Right-click on your preferred table, and select New Measure

 

Name your measure (What is Today’s Date), type “=Today()” and hit Enter on your keyboard.

 

The new measure is now created and available in the Fields pane under the selected table.

 

The new measure is now created and available in the Fields pane under the selected table.

Select a Card visual from the Visualization pane and drag and drop the new measure or click to visualise the measure on the selected card.

 

Select a Card visual from the Visualization pane and drag and drop the new measure

 

Below is what the Dax date (Today) function returns in Power BI.

 

what the Dax date (Today) function returns in Power BI.

 

2.Using Today() to return the last date of the previous month.

Before working with dates, you need to understand that dates are stored as numbers, in exactly the same way that Excel works with dates.

This means that if today’s date is 5/1/2022 (US system remember so that is 1st May 2022), subtracting 1 gives you the previous date (30th April 2022), while adding 1 takes you one day to the future (2nd May 2022).

 

As you can see, subtracting 1 from the DAX date function =Today() produces the day before the specified date.

 

Conclusion

The DAX TODAY function shows the current date.

It is incredibly useful when working with date-related data and so something you should learn while you are still a beginner to DAX.

It is something that we cover on our Beginners DAX Course.

 

Other DAX Functions

The DAX Calculate Function

The Today Function In DAX

DAX Replace Function

 

 

About Ben Richardson

Ben is a director of Acuity Training which he has been running for over 10 years.


He is a Natural Sciences graduate from the University of Cambridge and a qualified accountant with the ICAEW.


He previously worked as a venture capitalist and banker and so had extensive experience with Excel from building financial models before moving to learn SQL, Microsoft Power BI and other technologies more recently.