Page tree

Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

D toc

...

Excerpt

Returns the serial date number for the last day of the month before or after a specified number of months from a starting serial date number.

D s lang vs sql

D s
snippetBasic

D lang syntax
RawWrangletrue
Typeref
showNotetrue
WrangleTextderive type:single value:eomonth(myDate, 3)

eomonth(myDate, 3)

Output: Returns the values for the last date of the month that is three months after the serial date number value in the myDate column. 

D s
snippetSyntax

D lang syntax
RawWrangletrue
Typesyntax
showNotetrue
WrangleTextderive type:single value:eomonth(start_date_int,delta_months)

eomonth(start_date_int,delta_months)


ArgumentRequired?Data TypeDescription
start_date
_int
Y
Integer
DatetimeStarting date
to compare as a serial date value
.
delta_monthsYintegerNumber of months before or after the starting date to apply to the date value.

D s lang notes

start_date

Starting date values from which to compute end-of-month values.

...

D s
snippetusage
 

Required?Data TypeExample Value
YesLiteral
integer
Datetime or column referenceLastContactDate

delta_months

Number of months to add to the

...

date value to determine the month whose last date is returned.

  • Negative integer values are accepted.

D s
snippetusage

Required?Data TypeExample Value
YesInteger-3


D s
snippetExamples

Example - EOMONTH Function

Source:

In the following table, you can see how the the end-of-month values are calculated from a baseline

...

date

...

of June 15, 2020.

eventIdeventDate
eventSerialDate
deltaMonth
106/15/2020
43997
-24
206/15/2020
43997
-18
306/15/2020
43997
-12
406/15/2020
43997
-6
506/15/2020
43997
-3
606/15/2020
43997
-2
706/15/2020
43997
-1
806/15/2020
43997
0
906/15/2020
43997
1
1006/15/2020
43997
2
1106/15/2020
43997
3
1206/15/2020
43997
6
1306/15/2020
43997
12
1406/15/2020
43997
18
1506/15/2020
43997
24

Transformation:

D trans
RawWrangletrue
p03Value'deltaMonthSerialDate'
Typestep
WrangleTextderive type:single value:eomonth(

...

eventDate,deltaMonth) as:'deltaMonthSerialDate'
p01NameFormula type
p01ValueSingle row formula
p02NameFormula
p02Valueeomonth(

...

eventDate,deltaMonth)
p03NameNew column name
SearchTermNew formula

Results:

eventIdeventDate
eventSerialDate
deltaMonth

deltaMonthSerialDate

106/15/2020
43997
-2443281
206/15/2020
43997
-1843465
306/15/2020
43997
-1243646
406/15/2020
43997
-643830
506/15/2020
43997
-343921
606/15/2020
43997
-243951
706/15/2020
43997
-143982
806/15/2020
43997
044012
906/15/2020
43997
144043
1006/15/2020
43997
244074
1106/15/2020
43997
344104
1206/15/2020
43997
644196
1306/15/2020
43997
1244377
1406/15/2020
43997
1844561
1506/15/2020
43997
2444742


D s also
labeldate