Rules / Formatting

First letter of objects must be capitalized

info FIRST_LETTER_OF_OBJECTS_MUST_BE_CAPITALIZED · ported · model layer · scope: Table, Measure, Hierarchy, CalculatedColumn, CalculatedTable, CalculatedTableColumn, CalculationGroupTable

What it checks

Tables, measures, hierarchies, calculated columns, calculated tables, and calculation groups whose first character has an upper case form and is not upper case.

Each finding names the object the way the rest of the tool does: a measure as [total sales], a table or a calculation group as 'sales', a calculated column as 'sales'[unit price], and a hierarchy by its name alone with its table in the detail.

Example

Fires the rule
table Sales
	column Amount
		dataType: decimal
		isHidden
		summarizeBy: none
		sourceColumn: Amount

	measure 'total sales' = SUM('Sales'[Amount])
		formatString: #,0
After the fix
table Sales
	column Amount
		dataType: decimal
		isHidden
		summarizeBy: none
		sourceColumn: Amount

	measure 'Total Sales' = SUM('Sales'[Amount])
		formatString: #,0

Why it matters

Object names are the model's user interface: they appear in the field list, on axis labels, in tooltips, and in every export, and nothing capitalizes them for you. A field list that mixes "Sales Amount" with "total cost" reads as unfinished, and it tells a report author that the two fields came from different places and may not be equally trustworthy. Capitalizing the first letter costs nothing, survives every refresh, and is the convention nearly every published model follows. A name starting with a digit or a symbol is not flagged, because those characters have no upper case form.

How to fix it

In Power BI Desktop, double-click the object in the Data pane and retype the name, or select it and edit Name in the Properties pane of the model view. In the TMDL file the name is on the declaration line, so measure 'total sales' = becomes measure 'Total Sales' =. Renaming in Desktop carries the new name into the visuals bound to the object and into the DAX that references it; a hand edit in the file does not, so open the report and check its visuals after one.

When to ignore it

A name that is lower case on purpose is the exception worth keeping: eCommerce Orders, iPhone Sales, and anything else whose spelling belongs to a brand rather than to your style guide. Capitalizing those makes them wrong rather than tidy. Outside that, a lower case first letter is a slip, and the rule is reporting it before a reader does.

To ignore this rule on one object, add annotation pbiplint.ignore = FIRST_LETTER_OF_OBJECTS_MUST_BE_CAPITALIZED under the object in its TMDL file. Power BI Desktop keeps the annotation. To turn the rule off for a whole project, set "FIRST_LETTER_OF_OBJECTS_MUST_BE_CAPITALIZED": "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)