Forum Discussion

Anonymous's avatar
Anonymous
Not applicable
6 years ago

More than 3 relationships between same table

Is it possible to use nested USERELATIONSHIP? Is yes, can you please provide the syntax/solution to the below example.

I have to create 5 relationships between two tables like below

Example: TABLE A has columns like REGION, DIVISION, SALES METHOD, MAJOR CODE, VERTICALS. All these 5 columns has to be linked with TABLE B which has one column to be linked is SEGMENT FACTORS.

Can you please provide a solution to this?

 

 
 

3 Replies

  • v-xuding-msft's avatar
    v-xuding-msft
    Community Support

    Hi Anonymous ,

     

    Up to 10 USERELATIONSHIP functions can be nested; however, your expression might have a deeper level of nesting, ie. the following sample expression is nested 3 levels deep but only 2 for USEREALTIONSHIP: =CALCULATE(CALCULATE( CALCULATE( <anyExpression>, USERELATIONSHIP( t1[colA], t2[colB])), t99[colZ]=999), USERELATIONSHIP( t1[colA], t2[colA])).

    =
    CALCULATE (
        CALCULATE (
            CALCULATE ( SUM ( table[sales] ), USERELATIONSHIP ( t1[colA], t2[colB] ) ),
            t99[colZ] = 999
        ),
        USERELATIONSHIP ( t1[colA], t2[colA] )
    )
    

     

    Reference:

    https://docs.microsoft.com/en-us/dax/userelationship-function-dax

     

     

    • Anonymous's avatar
      Anonymous
      Not applicable

      Hello Xue,

       

      Thank you for providing the syntax. Can you please be more specific  on the syntax like what would be the condition for t99[colZ]=999

      Or I would appreciate if you provide the formula with respect to the screen shot that would be of great help.

       

      Thanks

      Deepak

      • Anonymous's avatar
        Anonymous
        Not applicable

        I have the same doubt, Deepak.

         

        Some answer, Xue Ding?