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

Function withFormulaFilterFor Beta

withFormulaFilterFor(attribute, filter): CalculatedMeasureTransformer

Returns a transformer that sets the calculated measure formula's filter for an attribute: upserts the filter when one is provided (replacing any existing filter on the same attribute, otherwise adding it), or removes it when filter is null.

This is the convenient primitive for driving a formula filter from a filter tile.

Parameters

ParameterTypeDescription
attributeAttributeThe attribute the filter targets.
filterFilter | nullThe filter to set, or null to remove the attribute's filter.

Returns

CalculatedMeasureTransformer

A transformer producing the updated calculated measure.

Example

Drive a formula filter from a filter tile — upsert on select, remove on clear:

// given a <MemberFilterTile> for DM.Category.Category and a `revenue` measure in state:
const onChange = (filter: Filter | null) =>
  setRevenue(withFormulaFilterFor(DM.Category.Category, filter)(revenue));
Last Updated: