ANNIVERSARYDAYS(A,B)
  • 1 Minute to read
  • Dark
    Light
  • PDF

ANNIVERSARYDAYS(A,B)

  • Dark
    Light
  • PDF

Article summary

Date Transform: ANNIVERSARYDAYS(A,B)

Number of days between Day/Month(A) and Day/Month(B) as if A and B were both in the same year


ANNIVERSARYDAYS(A,B) = DayOfYear(B) - DayOfYear(A) 

where 

DayOfYear(B) = number of days between B and the start of the year B 

DayOfYear(A) = number of days between A and the start of the year A


Purpose

Use this function to:
  • Calculate the number of days until a specific anniversary
  • Calculate the number of days past a specific anniversary

Return Value

PropertyValue
FieldTypeInteger
FieldSizeLow
DataTypeDiscrete
DataSizeShort


Example Return Value: -365....365  

Parameters

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”: “ANNIVERSARYDAYS(A,B)”ANNIVERSARYDAYS(A,B)
A“p2”: “DateField1”
“p2”: “#YYYY-MM-DD”
Required. The comparative field.
Supports:  Date, DateTime, Fixed_Value
Fixed Value = #YYYY-MM-DD
e.g. #2021-04-05
B“p3”: “DateField2”
“p2”: “#YYYY-MM-DD” 
Required. The anniversary field.
Supports:  Date, DateTime, Fixed_Value
Fixed Value = #YYYY-MM-DD
e.g. #2021-04-05

JSON Sample

Usage Notes

If DayOfYear(B) is before DayOfYear(A) then ANNIVERSARYDAYS(A,B) will be negative.

If DayOfYear(B) is after DayOfYear(A) then ANNIVERSARYDAYS(A,B) will be positive.

Example

ExampleDetails
DescriptionDays this year until anniversary of first transaction
Input
  • Table: = [customer]
  • Function: = DateTransform
  • DateTimeFunction: = ANNIVERSARYDAYS(A,B)
  • A:= #2023-01-01
  • B: = [transactions].[first_transaction] 
  • Name: = Anniversary2
Sample



Was this article helpful?

What's Next