Date Shifting feature

Atoti Common Libraryprovides all the tools for the date slicing feature. It mainly provides a slicing post-processor and an analysis hierarchy.

Hierarchy

The DateSlicerHierarchy works with the shift post-processor. It provides a list of available dates and specific dates such as Yesterday, Last End Of Month, and so on.

See the DateSlicerHierarchy documentation for how to set up the hierarchy.

Post-processors

UnfilteredDateShiftPostProcessor

This post-processor is derived from the NeighborValuePostProcessor with the following extra features:

  • It removes any filter set on the date hierarchy to allow the shift even if the date set has been filtered.
  • It can shift depending on the DateSlicerHierarchy selected member in its setup.

For setup details, see UnfilteredDateShiftPostProcessor.

DefaultMemberHierarchyPostProcessor

When used on a distributed environment, the nodes that don’t have specific level members won’t be part of a query. That could be problematic when using some day-to-day features with the DateSlicerHierarchy. For instance if we want to perform the difference between today (2018-02-28) and 2018-02-25 by setting the DateSlicerHierarchy to 2018-02-25, as today’s cube doesn’t hold 2018-02-25 it won’t be called for today’s date.

Therefore, this DefaultMemberHierarchyPostProcessor resets the hierarchy to the default value.

For setup details, please see DefaultMemberHierarchyPostProcessor.

Metric Post-Processor Underlying
DtD Formula Today, Shifted
Shifted UnfilteredDateShiftPostProcessor Native
Today DefaultMemberHierarchyPostProcessor Native
Native

Fixed days

The property SpecificDates used by the DateSlicerHierarchy and the UnfilteredDateShiftPostProcessor is filled with the specific fixed date markers. It is a comma-separated list of use value equals technical value, for instance: “Yesterday=DAY-1,Tomorrow=DAY+1,End Of Month=EOM-1,End Of Quarter=EOQ-1,End Of Year=EOY-1”

The technical value is composed of a three-character identifier followed by an integer. The shifters are registered on the Atoti registry and implement the interface IMoveKind.

Here are the possible provided values:

Key Shifter Number Explanation
DAY DayMoveKind number of days Shifts the current day for a certain amount of days.
EOM EndOfMonthMoveKind number of months Shifts the current month for a certain amount and selects the last opened day.
EOQ EndOfQuarterMoveKind number of quarters Shifts the current quarter for a certain amount and selects the last opened day.
EOY EndOfYearMoveKind number of years Shifts the current year for a certain amount and selects the last opened day.
WDA WeekDayMoveKind day of the week Shifts to the last selected day of the week or before if the day is closed.

The date shifts use an IBusinessDayCalendar to find out the business days.

Here is the template to create a custom date shift:

@QuartetExtendedPluginValue(intf = IMoveKind.class, key = EndOfYearMoveKind.PLUGIN_KEY)
@AllArgsConstructor
public class EndOfYearMoveKind implements IMoveKind {

    public static final String PLUGIN_KEY = "EOY";
    private final long amount;

    @Override
    public @NonNull LocalDate moveToBusinessDay(@NonNull LocalDate date, @NonNull IBusinessDayCalendar calendar) {
        date = LocalDate.of(date.getYear() + 1, Month.JANUARY, 1).plusYears(amount);
        return DayMoveKind.dayMove(date, calendar, -1);
    }

    @Override
    public String getType() {
        return PLUGIN_KEY;
    }
}