DAX Filter - USERELATIONSHIP function

Specifies the relationship to be used in a specific calculation as the one that exists between columnName1 and columnName2.
USERELATIONSHIP (<columnName1>, <columnName2>) 

columnName1
A fully qualified name of a column that represents the many side of the relationship to be used.
If the parameters are given in a reverse order, the function will swap them before using them.
This parameter cannot be an expression.
columnName2
A fully qualified name of a column that represents one side or lookup side of the relationship to be used.
If the parameters are given in a reverse order, the function will swap them before using them.
This parameter cannot be an expression.
DAX USERELATIONSHIP function does not return any value. The function only enables the indicated relationship for the duration of the calculation.
USERELATIONSHIP can only be used in DAX functions that take a filter as a parameter. For example, CALCULATE, CALCULATETABLE, CLOSINGBALANCEMONTH, CLOSINGBALANCEQUARTER, CLOSINGBALANCEYEAR, OPENINGBALANCEMONTH, OPENINGBALANCEQUARTER, OPENINGBALANCEYEAR, TOTALMTD, TOTALQTD and TOTALYTD functions.
USERELATIONSHIP can only be used in DAX functions that take a filter as a parameter. For example, CALCULATE, CALCULATETABLE, CLOSINGBALANCEMONTH, CLOSINGBALANCEQUARTER, CLOSINGBALANCEYEAR, OPENINGBALANCEMONTH, OPENINGBALANCEQUARTER, OPENINGBALANCEYEAR, TOTALMTD, TOTALQTD and TOTALYTD functions.
USERELATIONSHIP uses the existing relationships in the model, identifying relationships by their ending point columns.
USERELATIONSHIP uses the existing relationships in the model, identifying relationships by their ending point columns.
In USERELATIONSHIP, the status of a relationship is not important; that is, whether the relationship is active or not does not affect the usage of the function. Even if the relationship is inactive, it will be used and overrides any other active relationships that might be present in the model but not mentioned in the function parameters.
In USERELATIONSHIP, the status of a relationship is not important; that is, whether the relationship is active or not does not affect the usage of the function. Even if the relationship is inactive, it will be used and overrides any other active relationships that might be present in the model but not mentioned in the function parameters.
An error is returned if any of the columns named as a parameter is not part of a relationship or the parameters belong to different relationships.
An error is returned if any of the columns named as a parameter is not part of a relationship or the parameters belong to different relationships.
If multiple relationships are needed to join table A to table B in a calculation, each relationship must be indicated in a different USERELATIONSHIP function.
If multiple relationships are needed to join table A to table B in a calculation, each relationship must be indicated in a different USERELATIONSHIP function.
If CALCULATE expressions are nested, and more than one CALCULATE expression contains a USERELATIONSHIP function, then the innermost USERELATIONSHIP is the one that prevails in case of a conflict or ambiguity.
If CALCULATE expressions are nested, and more than one CALCULATE expression contains a USERELATIONSHIP function, then the innermost USERELATIONSHIP is the one that prevails in case of a conflict or ambiguity.
Up to 10 USERELATIONSHIP functions can be nested. However, your expression might have a deeper level of nesting.
Up to 10 USERELATIONSHIP functions can be nested. However, your expression might have a deeper level of nesting.
Product Sales:= CALCULATE ( 
   SUM (Sales[Sales Amount]), 
   USERELATIONSHIP (Sales[Product],Products[Product]) 
)

    53 Lectures 
     5.5 hours 

 Abhay Gadiya

    24 Lectures 
     2 hours 

 Randy Minder

    26 Lectures 
     4.5 hours 

 Randy Minder
 Print
 Add Notes
 Bookmark this page