Cheatsheet for DAX date and time functions

Commonly used functions I use for DAX date and time functions including Count of Days in Current Year, wrote this about 5 years ago and it was last updated about 5 years ago.


← Back to the Posts

Insert these as measures or use in formulas for new columns in a DAX table

For these examples TODAY() = 07/04/2017

DaysThisYear = DATEDIFF(DATE(YEAR(TODAY()),1,1),DATE(YEAR(TODAY())+1,1,1)-1,DAY)+1 // returns 365 
DaysThisFinancialYear = DATEDIFF(DATE(YEAR(TODAY()),7,1),DATE(YEAR(TODAY())+1,7,1)-1,DAY)+1 // returns 365_
DaysElapsedThisYear = DATEDIFF(DATE(YEAR(TODAY()),1,1),TODAY(),DAY)+1  // returns 97
LastDayOfThisMonth = FORMAT(EOMONTH(TODAY(),0),"DD")  // returns 30