The Today Function [DAX’s Functions]
Contents
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-2Syntax 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.
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).
OR from the Fields tab (#1), right-click on your preferred table, and select New Measure (#2). See below.
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.
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.
Below is 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).
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