abstract_measures
Detect duplicated DAX logic across measures in a Power BI semantic model and identify measures that compute the same thing and could share a calculation group or helper table.
Instructions
Find the logic that is written more than once in a semantic model.
Use this tool when the user asks to:
Find duplicated or copy-pasted logic across measures.
Know which measures compute the same thing and could share one.
Find the measures that differ only in a number or a column, which is what a calculation group is for.
Args: pbip_path: Path to the root .pbip directory. table: Only look at the measures of this table. min_group_size: How many measures have to share a shape before it is reported. Two is the minimum.
Returns: Dict with the groups found and, for each, what the duplication looks like: which measures share it and where exactly they differ.
It does not write anything and does not apply the abstraction. A
Tabular measure cannot take a parameter, so the answer is a
calculation group, a helper table or a rewrite in place — and
which one is right depends on the model.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| table | No | ||
| pbip_path | Yes | ||
| min_group_size | No |
Output Schema
| Name | Required | Description | Default |
|---|---|---|---|
No arguments | |||