Function withUpdatedFormulaFilter Beta
withUpdatedFormulaFilter(
match,updateFn):CalculatedMeasureTransformer
Returns a transformer that functionally updates the filter(s) matching the target, keeping the same context key so the formula expression is left untouched.
Useful for tweaks such as narrowing a filter's members. Returns the measure unchanged when nothing matches.
Parameters
| Parameter | Type | Description |
|---|---|---|
match | FormulaFilterMatcher | How to target the filter to update. See FormulaFilterMatcher. |
updateFn | (filter) => Filter | Maps the matched filter to its replacement. |
Returns
A transformer producing the updated calculated measure.
Example
Narrow the existing filter's members to a fixed set:
const narrowed = withUpdatedFormulaFilter(DM.Category.Category, () =>
filterFactory.members(DM.Category.Category, ['Cell Phones', 'Laptops']),
)(revenue);