AGE(A)
  • 1 Minute to read
  • Dark
    Light
  • PDF

AGE(A)

  • Dark
    Light
  • PDF

Article summary

Date Transform: AGE(A)

Age in years at the time the field was built

Number of whole years between Date(Time) field A and today, where today is the date on which the field was built.

Purpose

Use this function to:
  • Calculate age of customers at the time of Data Load
  • Calculate transaction age in years

Return Value

PropertyValue
FieldTypeInteger
FieldSizeLow / Med 
DataTypeDiscrete
DataSizeShort


Example Return Value: 0....N  where N is maximum number of years between today and Field(A)

Parameters

ParameterJSONDescription
Table“targetTable”: “MyTableName”The target table on which the new field will be created
Filter“dataset”: {DataSet_JSON}Optional.   If a filter is applied, records not in the filter Recordset will be returned as null.
DateTimeFunction“p1”: “AGE(A)”AGE(A)
A“p2”: “DateFieldName”Required.
Date Field, or fixed value using #YYYY-MM-DD notation.
If FIXED_VALUE is used, every row will have the difference in years between TODAY and FIXED_VALUE.

JSON Sample


Usage Notes

The values returned by AGE(A) will depend on the value of TODAY when the field is calculated, and so will change each time a load script is executed.

Example

ExampleDetails
DescriptionCalculate Transaction Age in Years
Input
  • Table: = [transactions]
  • Function: = DateTransform
  • DateTimeFunction: = AGE(A)
  • A:= [transactions].[date]
  • Name: = Age
Sample



Was this article helpful?

What's Next