Page tree

Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.
Comment: Published by Scroll Versions from space DEV and version r095

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 date.

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,delta_months)

eomonth(start_date,delta_months)


ArgumentRequired?Data TypeDescription
start_dateYDatetimeStarting date.
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 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.

eventIdeventDatedeltaMonth
106/15/2020-24
206/15/2020-18
306/15/2020-12
406/15/2020-6
506/15/2020-3
606/15/2020-2
706/15/2020-1
806/15/20200
906/15/20201
1006/15/20202
1106/15/20203
1206/15/20206
1306/15/202012
1406/15/202018
1506/15/202024

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:

eventIdeventDatedeltaMonth

deltaMonthSerialDate

106/15/2020-2443281
206/15/2020-1843465
306/15/2020-1243646
406/15/2020-643830
506/15/2020-343921
606/15/2020-243951
706/15/2020-143982
806/15/2020044012
906/15/2020144043
1006/15/2020244074
1106/15/2020344104
1206/15/2020644196
1306/15/20201244377
1406/15/20201844561
1506/15/20202444742


D s also
labeldate