Forum Discussion

Anonymous's avatar
Anonymous
Not applicable
6 years ago
Solved

Impossible to create a calculated column from 2 tables

Hello,
I have 2 databases linked with this type : *:* through the column "KEY".
I try to create a calculated column "Same domain" in database 1 : It gives the value "x" if the value of the column "Domain" is the same in the 2 linked databases.
I have tried to implement this function but it is not working :
Same Domain = if('Database1'[Domain]=related('Database2'[Domain]);"x";blank())
The error message is "the column 'Database2'[Domain] does not exists or doesn't have any link with a table available in the current context"...
I have checked the links between the 2 tables and they look good : *:*
Could you help me please ?
Thank you
  • Hi,

     

    According to your description, i create two tables to test:

        

    Then create a calculated column:

    Same Domain = if('Database1'[Domain] in SELECTCOLUMNS(RELATEDTABLE(Database2),"Domain",[Domain]),"x",blank())

    And in table 'Database1', it shows:

    Hope this helps.

     

    Best Regards,

    Giotto Zhi

     

2 Replies

  • az38's avatar
    az38
    Icon for Community Champion rankCommunity Champion

    hi Anonymous 

    as you have many-to-many *:* relationships this error sounds ok, because it is not clear what exactly row from database2 should be associated from row1.

    you should change your business logic. how do you plan to resolve this ambiguous?

     

    do not hesitate to give a kudo to useful posts and mark solutions as solution

  • v-gizhi-msft's avatar
    v-gizhi-msft
    Icon for Community Support rankCommunity Support

    Hi,

     

    According to your description, i create two tables to test:

        

    Then create a calculated column:

    Same Domain = if('Database1'[Domain] in SELECTCOLUMNS(RELATEDTABLE(Database2),"Domain",[Domain]),"x",blank())

    And in table 'Database1', it shows:

    Hope this helps.

     

    Best Regards,

    Giotto Zhi