tidy_slicer_layout
De-overlaps and snap-aligns slicers in a closed .pbix report. Sizes unchanged, intentional overlaps flagged, cleaned layout written back.
Instructions
ONE-CALL conservative slicer cleanup for a CLOSED .pbix. Give ONLY the .pbix path (tidies EVERY page) or the .pbix + a page name (tidies that page). It (1) DE-OVERLAPS: any slicer whose bounding box overlaps another slicer is nudged by the SMALLEST clean move that clears the collision - kept near its original spot, on-canvas, aligned to its neighbours, no new overlap; and (2) SNAP-ALIGNS: a slicer whose left or top edge sits a few px off a shared edge is snapped onto it. CONSERVATIVE by design for client reports: only SLICERS ever move, sizes are NEVER changed, and any nudge/snap that would create fresh overlap is rejected. Slicer-over-NON-slicer overlaps (e.g. a State slicer deliberately layered over a wide date-label card) are FLAGGED, not moved, unless deOverlapNonSlicers=true. Writes the .pbix back offline (Report/Layout patched, DataModel byte-preserved). The .pbix must NOT be open in Power BI Desktop. Returns { ok, pagesScanned, pagesTidied, moveCount, moves:[{page,slicer,reason,before{x,y,w,h},after{x,y,w,h}}], flaggedCount, flagged, persistedToDisk }.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| page | No | optional: a single page (name/displayName, loose match) to tidy; omit to tidy ALL pages | |
| pbix | Yes | absolute path to the .pbix (must be CLOSED in Power BI Desktop) | |
| deOverlapNonSlicers | No | also nudge slicers off NON-slicer visuals (default false: those overlaps are flagged, not moved, since they are often a deliberate header layering) |