DATEDIFF DAX Function (Date and Time)
Returns the number of units (unit specified in Interval) between the input two dates.
Syntax
Parameter | Attributes | Description |
---|---|---|
Date1 |
A date in datetime format that represents the start date. |
|
Date2 |
A date in datetime format that represents the end date. |
|
Interval |
The unit that will be used to calculate, between the two dates. It can be SECOND, MINUTE, HOUR, DAY, WEEK, MONTH, QUARTER, YEAR. |
Return values
The count of interval boundaries crossed between two dates.
Remarks
The result is positive if Date2 is larger than Date1.
The result is negative if Date1 is larger than Date2.
Previous versions of the DAX engine (earlier than 2018) could provide an error if Date1 is larger than Date2.
Last update: Jan 23, 2021 » Contribute » Show contributors
Contributors: Alberto Ferrari, Marco Russo, Jes Hansen
MSDN documentation: https://docs.microsoft.com/en-us/dax/datediff-function-dax