A Teradata Warehouse Miner specific function is provided for calculating the difference between two Date and/or Timestamp expressions in various units. The integer measures are calculated by expressing both dates in the requested units and then taking the integer difference between the two (for example, the difference between April 1 and March 31 is 1 month). The fractional measures are in days converted to fractions of longer time periods.
Either Date or Timestamp expression may be a literal value, the built-in function Current Date or Current Timestamp, or the analytic data set's target date value.
When dragging a Date Difference function into a variable, the following tree element is created.
Variable Creation > Input > Variables: SQL Elements pane - Date and Time > Date Difference
Columns and/or other expressions/literals that resolve to a date or timestamp can be moved over the (empty) branches of the tree.
Options to compute the difference in Days, Weeks, Months, Quarters or Years are set through the Properties panel. If Weeks, Months, Quarters or Years are requested, the units may be calculated in one of two different ways, as described on the Properties panel. Double-click on Date Difference, or highlight it and click on Properties.
Variable Creation > Input > Variables: SQL Elements pane - Date and Time > Date Difference Properties