DATEDIFF
Description:
This function is used to get the difference of two dates.
Syntax:
DATEDIFF (String_Expression , Scalar_Expression1 , Scalar_Expression2)
Return type:
SCALAR
Parameters:
Parameter | Description |
|---|---|
String_Expression | This value specifies the unit called as interval, in which the difference needs to be evaluated, Supported Intervals- year, month, quarter, week, day, yyyy, yy, mm, m, qq, q, ww, w, dy, d. |
Scalar_Expression1 | This value defines the start date. |
Scalar_Expression2 | This value defines the end date. |
Example:
WITH MEMBER [Measures].[Result] AS DATEDIFF(year, cdate('2036-05-01'), cdate('2040-10-01')) SELECT [Measures].[Result] ON 0 FROM [AdventureWorksMF]