persist_open_model
Persist model edits in an open Power BI Desktop report by applying them to the live model and triggering File>Save, so the .pbix retains the full model and data.
Instructions
DATA-PRESERVING persist for a report OPEN in Power BI Desktop (the loop for a loaded report like a live dashboard): apply the model edits to the connected LIVE model (SaveChanges + a Calculate when a calc column/relationship changed), then drive Desktop's own File>Save (scripted Ctrl+S, located by the session's engine port) so Desktop writes its full model+DATA image back to the .pbix. Works for ANY model including Power Query (M) import models. PREREQUISITE (manual): the .pbix must be OPEN in Power BI Desktop and connected via connect_model - Desktop is the only host that can persist a data-loaded, M-based model to disk. Pass pbixPath so the tool can confirm the save landed.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| edits | Yes | JSON array of edit objects, each with an "op" | |
| pbixPath | No | the open report's .pbix path (to confirm the save landed; optional) | |
| sessionId | Yes | sessionId from connect_model (a LOCAL Desktop model) | |
| saveRetries | No | scripted File>Save attempts before giving up (default 2) |