Code action DR005
(Readability) Prefix temporary column
Description
It is recommended to use a consistent prefix for temporary columns, to more easily distinguish them from base columns or measures. The default prefix is @
but you can configure which prefix to use, to match your preferred style, under Tools > Preferences > DAX Editor > Code Actions.
Example
Change:
ADDCOLUMNS(
'Sales',
"Sales With Tax", 'Sales'[Sales Amount] * 1.25
)
To:
ADDCOLUMNS(
'Sales',
"@Sales With Tax", 'Sales'[Sales Amount] * 1.25
)
Why is Tabular Editor suggesting this?
This code action is designed to improve the readability of your DAX code. By using a consistent naming convention for your temporary columns, it is easier to understand the purpose of each column, and to distinguish between base columns, measures, and extension columns.
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.