Rules / Maintenance
Steps keep Power Query's default names
What it checks
Power Query queries whose steps keep the names Power BI Desktop gives them, such as Changed Type, Added Custom1, or Removed Other Columns, reported once per query.
Each finding names the partition, the shared expression, or, for an incremental refresh policy's own query, the table. Its detail names the query, how many of its steps keep a default name, and up to two of them, as query 'Sales': 3 steps keep default names, such as 'Changed Type' and 'Added Custom1'. The location is the line and column of the first such step in the TMDL file.
The names read are Desktop's English defaults: Changed Type, Changed Type with Locale, Promoted Headers, Removed Columns, Removed Other Columns, Renamed Columns, Reordered Columns, Filtered Rows, Sorted Rows, Removed Duplicates, Grouped Rows, Merged Queries, Appended Query, Added Custom, Added Conditional Column, Added Index, Duplicated Column, Replaced Value, Pivoted Column, Unpivoted Columns, Unpivoted Other Columns, Split Column by Delimiter, Removed Top Rows, Removed Bottom Rows, Removed Blank Rows, Removed Alternate Rows, Removed Errors, Kept First Rows, Kept Range of Rows, Trimmed Text, Cleaned Text, Uppercased Text, Lowercased Text, Capitalized Each Word, Transposed Table, Filled Down, Filled Up, Invoke Custom Function, and Custom, and names that start with Expanded, Inserted, Extracted, or Calculated, each with or without a number after it.
Example
table Sales
column Region
dataType: string
summarizeBy: none
sourceColumn: Region
partition Sales = m
mode: import
source =
let
Source = #table(type table [Region = text, Amount = number], {{"East", 10}, {"West", 20}}),
#"Changed Type" = Table.TransformColumnTypes(Source, {{"Amount", type number}}),
#"Added Custom1" = Table.AddColumn(#"Changed Type", "Doubled", each [Amount] * 2, type number)
in
#"Added Custom1"
table Sales
column Region
dataType: string
summarizeBy: none
sourceColumn: Region
partition Sales = m
mode: import
source =
let
Source = #table(type table [Region = text, Amount = number], {{"East", 10}, {"West", 20}}),
#"Typed Amount" = Table.TransformColumnTypes(Source, {{"Amount", type number}}),
#"Added Doubled Amount" = Table.AddColumn(#"Typed Amount", "Doubled", each [Amount] * 2, type number)
in
#"Added Doubled Amount"
Why it matters
A step's name is what the next person reads first, in Applied steps and in every step that refers to it. Changed Type, Changed Type1, and Changed Type2 say that the types changed three times but not which columns, or why. Added Custom says a column was added but not what it holds. Someone who has to fix a refresh error, or change a calculation, then opens each step to find the one they need. Microsoft's guidance is to name them: "Document a Power Query solution by giving steps, queries, and groups meaningful names and descriptions. These details make the purpose of each transformation easier to understand and maintain." (Best practices, Document your work (opens in a new tab)).
How to fix it
In Power BI Desktop, choose Transform data, select the query, and in Applied steps right-click each step with a default name and choose Rename (Applied steps, Rename step (opens in a new tab)). Name what the step does to the data, such as Typed Amount or Added Doubled Amount. Desktop updates every step that refers to the renamed one. To say why as well, choose Properties instead, which takes a name and a description (Edit step names and their descriptions (opens in a new tab)). In the TMDL file, each step is a line of the partition's source block; rename it there and in every step that refers to it, and in the line after in.
When to ignore it
A short query whose steps say what they do, such as Source, a Promoted Headers step, and one Changed Type, reads clearly enough, and renaming its steps adds little. A team that agrees to keep Desktop's names, or queries generated by a tool and never edited by hand, can leave them too.
To ignore this rule on one object, add annotation pbiplint.ignore = DEFAULT_STEP_NAMES under the object in its TMDL file. Power BI Desktop keeps the annotation. To turn the rule off for a whole project, set "DEFAULT_STEP_NAMES": "off" under rules in pbiplint.config.json.
Quirks
- Each query is reported once, on its first step with a default name, with the count in the detail, since a shape Desktop writes on every query would bury the rest of the results if each step were its own finding.
- Only the query's own steps are read: the outermost
let. Steps inside a nestedletor a function are not. - Source and Navigation are not reported: they name what they are. A parameter or a function is not reported either, since it has no steps.
- Only the English names are read. Power BI Desktop in another language writes its own default names, which this rule does not know.
- A step named with a number after a default name, such as Added Custom1 or Changed Type2, counts as that default name.
- A query whose M does not parse is not read; it gets a
PARSE_ISSUEfinding instead.
Related rules
DEFAULT_PAGE_NAMEreports the same habit in the report: a page that keeps Power BI's default name.
Links
Check a model for this Improve this page (opens in a new tab)