add_template_measure
Add a measure to a table in a closed Power BI (.pbit) template by editing its model JSON on disk. Checks for name collisions and creates a .bak backup.
Instructions
Add a measure to a table in a closed .pbit template's model, editing the DataModelSchema JSON on disk with no Power BI Desktop. Collision-checked: fails if a measure of that name already exists on the table. The .pbit is written back in place (the original is copied to a .bak beside it first).
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| name | Yes | measure name | |
| table | Yes | home table for the measure | |
| pbitPath | Yes | path to the closed .pbit template | |
| expression | Yes | DAX expression, e.g. SUM(Sales[Amount]) | |
| formatString | No | format string, e.g. "#,0" or "0.0%" (optional) | |
| displayFolder | No | display folder (optional) |