fix_slicer_single_select
Set a field-parameter slicer to single-select to fix a flat-line chart where all options render at once; auto-picks the first option. Requires .pbix path and page name; optional chart or default_value
Instructions
ONE-CALL flat-line fix for a field-parameter-axis chart. Give ONLY the .pbix path and the page name (both are in a request like 'fix the flat line in Category vs Brand Share of ') - no slicer name, no boolean, no multi-step. Opens the CLOSED .pbix, finds the slicer bound to the page's FIELD PARAMETER (auto-detected: a slicer whose bound field is a field parameter - table==column, or the single-column-table field plotted on a chart axis), makes it SINGLE-SELECT (writes the ground-truth objects.selection[0].properties.strictSingleSelect=true), then writes the .pbix back (DataModel byte-preserved). THAT is the whole fix: a field-parameter-bound chart flat-lines because every option renders at once; single-select forces one option AND auto-picks the field parameter's first option (e.g. MonthYear) on open. If several field-parameter slicers exist, pass the optional 'chart' (its title/name/bound field) to disambiguate; if you already know a specific value, pass 'default_value' to pin the opening option (otherwise single-select auto-picks the first). Returns {ok, page, slicer, fieldParameter, strictSingleSelect, default_applied, before, after}. The .pbix must NOT be open in Power BI Desktop.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| page | Yes | the page: its displayName or name - a partial/loose match is accepted | |
| pbix | Yes | absolute path to the .pbix (must be CLOSED in Power BI Desktop) | |
| chart | No | optional: a chart on the page (title/name/bound field) to disambiguate WHICH field-parameter slicer to fix | |
| default_value | No | optional value to pin as the opening option; omit to let single-select auto-pick the field parameter's first option |