Technology Blogs by SAP
Learn how to extend and personalize SAP applications. Follow the SAP technology blog for insights into SAP BTP, ABAP, SAP Analytics Cloud, SAP HANA, and more.
cancel
Showing results for 
Search instead for 
Did you mean: 
AndreasForster
Product and Topic Expert
Product and Topic Expert
0 Kudos

This component enriches calendar dates with additional context, ie working days and non working days are identified. Such variables can help to enhance time-series forecasts in SAP Predictive Analytics, Automated Analytics mode.

Depending on your use case, there might be many further date-related variables that could help improve a time-series forecast.

Disclaimer

Please note that this component is not an official release by SAP and that it is provided as-is without any guarantee or support. Please test the component to ensure it works for your purposes.

Prerequisites

  • R libraries lubridate, Hmisc and timeDate must be installed.
  • One column of type Text must contain the date.

Limitations

The component is not optimised for performance. For datasets in which the same date occurs multiple times you may want to restrict the data to unique dates first, add the date attributes and join these to the whole dataset.

Usage

These parameters can be set by the user:

ParameterDescription
DateColumn that contains the date in textual format.
Date Format

Specifies the string column's date format in R notation. For instance: %d.%m.%Y

See the documentation of the as.Date() function for the syntax.

Holiday Reference

Specifies the region for identifying working days. Possible values are "London", "New York Stock Exchange", "Toronto Stock Exchange" and "Zurich".

Output column added by this component:

ColumnDescription
SundayMonthInd

Indicates if the date is a Sunday with the weekday’s occurrence count in the month so far. 0 otherwise.

MondayMonthIndIndicates if the date is a Monday with the weekday’s occurrence count in the month so far. 0 otherwise.
TuesdayMonthIndIndicates if the date is a Tuesday with the weekday’s occurrence count in the month so far. 0 otherwise.
WednesdayMonthIndIndicates if the date is a Wednesday with the weekday’s occurrence count in the month so far. 0 otherwise.
ThursdayMonthIndIndicates if the date is a Thursday with the weekday’s occurrence count in the month so far. 0 otherwise.
FridayMonthIndIndicates if the date is a Friday with the weekday’s occurrence count in the month so far. 0 otherwise.
SaturdayMonthIndIndicates if the date is a Saturday with the weekday’s occurrence count in the month so far. 0 otherwise.
LastSunday1 if last Sunday of the month. 0 otherwise.
LastMonday1 if last Monday of the month. 0 otherwise.
LastTuesday1 if last Tuesday of the month. 0 otherwise.
LastWednesday1 if last Wednesday of the month. 0 otherwise.
LastThursday1 if last Thursday of the month. 0 otherwise.
LastFriday1 if last Friday of the month. 0 otherwise.
LastSaturday1 if last Saturday of the month. 0 otherwise.
PenultimateSunday1 if penultimate Sunday of the month. 0 otherwise.
PenultimateMonday1 if penultimate Monday of the month. 0 otherwise.
PenultimateTuesday1 if penultimate Tuesday of the month. 0 otherwise.
PenultimateWednesday1 if penultimate Wednesday of the month. 0 otherwise.
PenultimateThursday1 if penultimate Thursday of the month. 0 otherwise.
PenultimateFriday1 if penultimate Friday of the month. 0 otherwise.
PenultimateSaturday1 if penultimate Saturday of the month. 0 otherwise.
Workingday1 if working day (Saturday, Sunday, Bank Holiday). 0 otherwise.
BeforeHoliday1 if before holiday. 0 otherwise.
Holiday1 if holiday (Saturday, Sunday, Bank Holiday). 0 otherwise.
ContributionToWorkingMonthIf working day: 1 divided by number of month’s working days. 0 otherwise.
ContributionToMonth1 divided by number of month’s days.
MonthWorkingDayIndIndicates if working day with the work day’s occurrence count in the month so far. 0 otherwise.
ReverseMonthWorkingDayIndIndicates if working day by counting down the work day’s occurrence count in the month. 0 otherwise.
Last5WDinMonthIndIndicates the month’s last 5 working days by counting them up from 1 to 5. 0 otherwise.
Last5WDinMonth1 if one the month’s last 5 working days. 0 otherwise.
Last4WDinMonthIndIndicates the month’s last 4 working days by counting them up from 1 to 4. 0 otherwise.
Last4WDinMonth1 if one the month’s last 5 working days. 0 otherwise.

How to Implement

The component can be downloaded as .spar file from GitHub. Then deploy it as described here. You just need to import it through the option "Import/Model Component", which you will find by clicking on the plus-sign at the bottom of the list of the available algorithms.

Example

This component was used to create some of the variables in the tutorial that forecasts the daily demand of the London bicycle hire scheme.

2 Comments