Forum Discussion

Anonymous's avatar
Anonymous
Not applicable
2 years ago
Solved

Custom Column

If Table 1 has a common feild as table two then bring third column from Table two in Table 1.

IF Table1(ID) = Table2(ID)

Than Return Table2(Name)

Not able to create direct relationship due to having indirect relationship between both the tables.

  • Anonymous's avatar
    Anonymous
    2 years ago

    Hi Anonymous ,

     

    According to your statement, I know there is no relationship between two tables. I suggest you to try code as below to achieve your goal.

    Name from Table 2 =
    /*Workaround 1: If you have one name for one ID*/
    CALCULATE (
        MAX ( Table2[Name] ),
        FILTER (
            Table2,
            Table2[ID] = EARLIER ( Table1[ID] )
        ) /*Workaround 2: If you have multiple names for one ID
    CONCATENATEX(FILTER(Table2,Table2[ID] = EARLIER(Table1[ID])),Table2[Name],",")*/
    )

    Result is as below.

     

    Best Regards,

    Rico Zhou

     

    If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

     

2 Replies

Replies have been turned off for this discussion
  • Anonymous's avatar
    Anonymous
    Not applicable

    Hi Anonymous ,

     

    According to your statement, I know there is no relationship between two tables. I suggest you to try code as below to achieve your goal.

    Name from Table 2 =
    /*Workaround 1: If you have one name for one ID*/
    CALCULATE (
        MAX ( Table2[Name] ),
        FILTER (
            Table2,
            Table2[ID] = EARLIER ( Table1[ID] )
        ) /*Workaround 2: If you have multiple names for one ID
    CONCATENATEX(FILTER(Table2,Table2[ID] = EARLIER(Table1[ID])),Table2[Name],",")*/
    )

    Result is as below.

     

    Best Regards,

    Rico Zhou

     

    If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.