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

Function dateMeasureRelativeFrom

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

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

An offset of 0 includes the anchor's own period; 1 excludes it and starts at the one after. 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 from 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 two years starting 1 January 2012.

filterFactory.dateMeasureRelativeFrom(
  measureFactory.max(DM.Commerce.Date.Days, 'Last Order'),
  DM.Commerce.Date.Years,
  0,
  2,
  '2012-01-01',
)
Last Updated: