Skip to content

Latest commit

 

History

History
41 lines (28 loc) · 1.3 KB

DI003.md

File metadata and controls

41 lines (28 loc) · 1.3 KB
uid category sub-category title author updated
DI003
Code actions
Improvements
Remove table name
Daniel Otykier
2024-12-19

Code action DI003 (Improvement) Remove table name from measure references

Description

Measure references should not include the table name, as the table name is unnecessary when referencing measures.

Example

Change:

'Internet Sales'[Internet Total Sales] * 1.25

To:

[Internet Total Sales] * 1.25

Why is Tabular Editor suggesting this?

In most situations, column references must be qualified by the table name. However, for measure references, the table name is always optional (since measure names are always unique within a model).

Thus, a best practice is to always reference measures without the table name, and always reference columns with the table name.

By applying this practice consistently, you make your code more concise and easier to read, and you make it easier to distinguish between measure references and column references.

Remarks

This code action has an (All occurrences) variant, which will appear when multiple sections of code can be improved. This variant will apply the code action to all relevant sections of the document at once.

Related to:

  • DI004 - Add table name to column references