add_measure_with_validation
Add a DAX measure to a Power BI model with automatic linting and validation. Catch syntax and best-practice issues before saving.
Instructions
Add a DAX measure to a semantic model with automated linting and validation.
Use this tool when the user asks to:
Create or add a new DAX measure to a Power BI model.
Validate DAX syntax and best practices (preventing division by zero, unformatted measures, etc.).
Dry-run a measure to check for lint issues before committing to TMDL.
Args: target: Target PBIP directory or TMDL path. measure_name: Name of the measure to create. table: Target table where the measure will reside. expression: DAX formula for the measure (e.g. "DIVIDE([Total Sales], [Units], 0)"). format_string: Format string (e.g. "$#,##0.00", "0.0%"). description: Measure documentation or business description. is_hidden: Whether the measure should be hidden in report view. fail_on_severity: Minimum lint severity that blocks creation ("error", "warning", "info"). dry_run: If True, validate lint rules without writing to disk. runtime_check: Whether to execute the measure against an active engine if connected. measure_writer: Optional custom measure writer callable.
Returns: Dict with success status, lint findings, and modified file paths.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| table | Yes | ||
| target | Yes | ||
| dry_run | No | ||
| is_hidden | No | ||
| expression | Yes | ||
| description | No | ||
| measure_name | Yes | ||
| format_string | No | ||
| runtime_check | No | ||
| measure_writer | No | ||
| fail_on_severity | No | warning |
Output Schema
| Name | Required | Description | Default |
|---|---|---|---|
No arguments | |||