sisense.com
✅ You are viewing documentation for the latest version of Compose SDK.
Version:

Function dateMeasureRelativeTo

dateMeasureRelativeTo( measure, level, offset, count, anchor?, config?): Filter

Creates a filter to isolate items whose measure value falls in a period before an anchor.

An offset of 0 includes the anchor's own period; 1 excludes it and ends at the one before. The level is the level the period is counted in, and it is not the level inside the measure.

Parameters

ParameterTypeDescription
measureMeasureMeasure to filter by.
levelLevelAttributeDate LevelAttribute the period is counted in.
offsetnumberPeriods to skip from the anchor; 0 includes the anchor's own period and 1 excludes it.
countnumberNumber of periods to include.
anchor?Date | stringDate to count to as yyyy-MM-dd or a Date, defaults to the current day.
config?BaseFilterConfigOptional configuration for the filter.

Returns

Filter

A filter instance.

Example

Filter for categories whose last order was in the year up to and including 1 June 2013.

filterFactory.dateMeasureRelativeTo(
  measureFactory.max(DM.Commerce.Date.Days, 'Last Order'),
  DM.Commerce.Date.Years,
  0,
  1,
  '2013-06-01',
)
Last Updated: