Rules / DAX Expressions

Measures should not be direct references of other measures

warning MEASURES_SHOULD_NOT_BE_DIRECT_REFERENCES_OF_OTHER_MEASURES · ported · model layer · scope: Measure

What it checks

Measures whose whole expression is a reference to another measure, such as [Total Sales].

Each finding names the alias, not the measure it points at, as [Revenue].

Example

Fires the rule
table Sales
	column Amount
		dataType: decimal
		sourceColumn: Amount
	measure 'Total Sales' = SUM(Sales[Amount])
		formatString: #,0
	measure Revenue = [Total Sales]
		formatString: #,0
After the fix
table Sales
	column Amount
		dataType: decimal
		sourceColumn: Amount
	measure 'Total Sales' = SUM(Sales[Amount])
		formatString: #,0

Why it matters

An alias measure is a second name for the same number. Reports pick one or the other, the two drift apart the first time someone edits the alias instead of the original, and anyone reading the model has to follow the reference to learn what it means.

How to fix it

Repoint the visuals that use the alias at the original, then delete it. In Power BI Desktop, right-click the alias in the Data pane and choose Delete from model. In the TMDL file, remove its measure block from the table.

Where the alias exists only because its name is the better one, do the rename the other way around: rename the original and delete the alias. Select the original in the Data pane, press F2, and type the new name, and Desktop repoints the visuals that use it. In the TMDL file the name is on the declaration line, so measure 'Total Sales' = becomes measure Revenue =, and a hand edit there does not update the report, so open the report and check its visuals afterwards.

When to ignore it

A rename in progress is the case that holds up: the alias keeps published reports working until each one is repointed, and it goes the day the last one moves. Give it an end date rather than leaving it. The argument that the alias puts the number in a second place in the field list does not hold, because the original's home table and display folder are both properties you can set on it, which is the same result without a second definition.

To ignore this rule on one object, add annotation pbiplint.ignore = MEASURES_SHOULD_NOT_BE_DIRECT_REFERENCES_OF_OTHER_MEASURES under the object in its TMDL file. Power BI Desktop keeps the annotation. To turn the rule off for a whole project, set "MEASURES_SHOULD_NOT_BE_DIRECT_REFERENCES_OF_OTHER_MEASURES": "off" under rules in pbiplint.config.json.

Quirks

Ported from Microsoft's Best Practice Analyzer ruleset (opens in a new tab).

Check a model for this Improve this page (opens in a new tab)