edit_measure_offline
Add or edit a DAX measure in a closed Power BI .pbix file, scripting Power BI Desktop's save to persist the change back to disk.
Instructions
Add or edit a measure on a CLOSED .pbix and save it back to disk. Briefly opens the file in the local Power BI Desktop (a Desktop window appears), adds/updates the measure via TOM, then drives Desktop's own File > Save (scripted Ctrl+S) so the change lands in the .pbix, and closes Desktop. An existing measure is updated (omit a field to keep it); a new one needs expression. Reports the before/after expression, format string and display folder, and whether the disk save was confirmed.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| name | Yes | measure name | |
| table | Yes | home table of the measure | |
| pbixPath | Yes | path to the closed .pbix | |
| expression | No | DAX expression (required to create a new measure; omit to keep an existing one) | |
| timeoutSec | No | seconds to wait for the model to load before giving up (default 180) | |
| saveRetries | No | scripted File > Save attempts before giving up (default 3) | |
| formatString | No | format string, e.g. "#,0" or "0.0%" (omit to keep) | |
| displayFolder | No | display folder (omit to keep) |