Metacenta

BI semantic layer · rule powerbi-bidirectional-filter

Power BI relationships filtering both ways

A Metacenta review checks this under the rule Power BI relationships filter one way. Everything below applies whether or not you ever commission one.

What this rule checks

From a Power BI semantic model's TMDL files, this rule flags each active relationship set to crossFilteringBehavior: bothDirections. An inactive relationship (isActive: false) is not flagged, because it filters nothing until a measure turns it on.

Why it matters

A filter can reach a table by two paths and change a total in ways a report author does not expect. It also slows every query that crosses the relationship.

How to fix it

Make Power BI relationships filter one way. Make the relationship single-direction. Where one measure needs the other direction, use CROSSFILTER inside that measure rather than on the model.

Before:

relationship sales_to_customer
	fromColumn: Sales.CustomerKey
	toColumn: Customer.CustomerKey
	crossFilteringBehavior: bothDirections

After:

relationship sales_to_customer
	fromColumn: Sales.CustomerKey
	toColumn: Customer.CustomerKey

When it is fine to leave

A bridge table in a many-to-many pattern often needs both directions to work. Keep it where the model is built for that, and say so in a description. Everything else should filter one way.

What we need to check it

The .tmdl files from a Power BI project saved in the PBIP format. We read relationship columns, direction and the active flag.