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

Function withReplacedFormulaFilter Beta

withReplacedFormulaFilter(match, newFilter): CalculatedMeasureTransformer

Returns a transformer that replaces the filter(s) matching the target with a new filter, keeping the same context key so the formula expression is left untouched.

Returns the measure unchanged when nothing matches; use withFormulaFilterFor when you want a missing filter to be added instead.

Parameters

ParameterTypeDescription
matchFormulaFilterMatcherHow to target the filter to replace. See FormulaFilterMatcher.
newFilterFilterThe replacement filter.

Returns

CalculatedMeasureTransformer

A transformer producing the updated calculated measure.

Example

Swap the filter for an attribute, keeping the formula expression unchanged:

const forLaptops = withReplacedFormulaFilter(
  DM.Category.Category,
  filterFactory.members(DM.Category.Category, ['Laptops']),
)(revenue);
Last Updated: