simplify_dax_measure
Rewrites DAX expressions into shorter equivalent forms and finds measures written the long way, replacing hand-rolled blank checks or IF chains with built-in functions.
Instructions
Rewrite a DAX expression in its shorter, equivalent form.
Use this tool when the user asks to:
Simplify, tidy or shorten a DAX measure.
Find the measures in a model that are written the long way.
Replace a hand-rolled blank check, error check or IF chain with the function that already does it.
Args: expression: The DAX expression to simplify. Mutually exclusive with pbip_path. pbip_path: A PBIP project to read the measures from. measure: The measure to simplify. Requires pbip_path. all_measures: Simplify every measure in the project and report which ones could be written shorter. Requires pbip_path. apply_lint: Include the linter verdict before and after, so a rewrite that silences a finding — or creates one — is visible.
Returns: Dict with the simplified expression and the rewrites that produced it. The equivalence is structural: the expression is never evaluated against data, so the rewrite changes the shape and not the meaning, and a reader can check it. An expression that could not be parsed comes back unchanged, with the reason.
This tool writes nothing. To apply the result, pass the
simplified expression to add_measure_with_validation.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| measure | No | ||
| pbip_path | No | ||
| apply_lint | No | ||
| expression | No | ||
| all_measures | No |
Output Schema
| Name | Required | Description | Default |
|---|---|---|---|
No arguments | |||