Which DAX function should you use to establish a virtual relationship between two tables with no physical relationship?

Prepare for the DP-600 Fabric Analytics Engineer Exam. Study with flashcards and multiple choice questions, each offering hints and detailed explanations. Enhance your chances of success on the exam!

Multiple Choice

Which DAX function should you use to establish a virtual relationship between two tables with no physical relationship?

Explanation:
When you want filters to flow between two tables that don’t have a physical relationship, you create a link at query time. TREATAS does exactly that: it maps values from one table’s column onto another table’s column, so filters propagate as if there were a relationship. In practice, you use TREATAS inside CALCULATE to apply a set of values from one table to another table that isn’t related. For example, CALCULATE(SUM(Sales[Amount]), TREATAS(VALUES(Sales[DateKey]), Dates[DateKey])) maps the distinct DateKey values from the Sales table to the Dates table, enabling a date filter on Sales to affect the measure via Dates even though no relationship exists. Other functions don’t create this kind of virtual bridge. PATH() works with hierarchical paths in parent-child structures. USERELATIONSHIP() activates an existing (often inactive) relationship, but it still requires a pre-defined relationship. CROSSFILTER() changes how filters flow across an existing relationship, not by creating a new, virtual one. So, the right choice is TREATAS because it establishes a query-time, virtual relationship between tables without adding a physical relationship.

When you want filters to flow between two tables that don’t have a physical relationship, you create a link at query time. TREATAS does exactly that: it maps values from one table’s column onto another table’s column, so filters propagate as if there were a relationship.

In practice, you use TREATAS inside CALCULATE to apply a set of values from one table to another table that isn’t related. For example, CALCULATE(SUM(Sales[Amount]), TREATAS(VALUES(Sales[DateKey]), Dates[DateKey])) maps the distinct DateKey values from the Sales table to the Dates table, enabling a date filter on Sales to affect the measure via Dates even though no relationship exists.

Other functions don’t create this kind of virtual bridge. PATH() works with hierarchical paths in parent-child structures. USERELATIONSHIP() activates an existing (often inactive) relationship, but it still requires a pre-defined relationship. CROSSFILTER() changes how filters flow across an existing relationship, not by creating a new, virtual one.

So, the right choice is TREATAS because it establishes a query-time, virtual relationship between tables without adding a physical relationship.

Subscribe

Get the latest from Examzify

You can unsubscribe at any time. Read our privacy policy