Rules / Naming Conventions

Partition name should match table name for single partition tables

info PARTITION_NAME_SHOULD_MATCH_TABLE_NAME_FOR_SINGLE_PARTITION_TABLES · ported · model layer · scope: Table

What it checks

Regular tables with exactly one partition whose name differs from the table name. Calculated tables and calculation groups are not checked.

Each finding names the table, as 'Sales', not the partition whose name differs, so open the table in the TMDL file to see the name the partition is carrying.

Example

Fires the rule
table Sales
	column 'Order ID'
		dataType: int64
		sourceColumn: OrderID
	column Amount
		dataType: decimal
		sourceColumn: Amount
	partition SalesData = m
		mode: import
		source = Sql.Database("contoso", "Sales")
After the fix
table Sales
	column 'Order ID'
		dataType: int64
		sourceColumn: OrderID
	column Amount
		dataType: decimal
		sourceColumn: Amount
	partition Sales = m
		mode: import
		source = Sql.Database("contoso", "Sales")

Why it matters

A single-partition table has no reason for its partition to carry a different name, and when it does it is usually the table's old name from before a rename. Refresh logs, error messages, and the TMDL file all name the partition, so a mismatch sends the reader looking for a table that no longer exists.

How to fix it

The partition's name sits on its declaration line, so partition SalesData = m under table Sales becomes partition Sales = m. Nothing else in the TMDL file refers to a partition by name, so on a single-partition table the rename changes nothing but the label in the refresh log. Power BI Desktop has no partition list and no field for a partition name: it names the partition when it creates the table and leaves the name alone afterwards, so a mismatch on a Desktop project points at a hand edit, a table renamed outside Desktop, or a model migrated from another tool. If a whole model needs correcting, Tabular Editor's partition editor renames partitions without opening each file.

When to ignore it

A partition that the people who run the refresh already know by another name can keep it, for example one named after the stored procedure that fills it, because that is the name they will look for when the refresh fails. Outside that, a single partition named anything but its table is a leftover, and the rename costs nothing.

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