Forum Discussion

calou_33's avatar
calou_33
New Member
8 years ago
Solved

Multiple column with foreign key

Hello,

 

I have a table A like this

 

IDField0Field1FIeld2Field 3
1tt111
2xx222
3cc121
4dd221
5yy111
6aa111

 

Table B as :

IDDesc
1YES
2NO

 

 

In Power BI how can i do to have a result like this :

IDField0Field1FIeld2Field 3
1ttYESYESYES
2xxNONONO
3ccYESNOYES
4ddNONOYES
5yyYESYESYES
6aaYESYES

YES

 I cannot make multiple relation

 

Thank for help

  • Hi calou_33,

     

    You could have a try with the formulas below.

     

    Column1 = LOOKUPVALUE('TableB'[Desc],TableB[ID],'TableA'[Field1])
    Column2 = LOOKUPVALUE('TableB'[Desc],TableB[ID],'TableA'[FIeld2])
    Column3 = LOOKUPVALUE('TableB'[Desc],TableB[ID],'TableA'[Field 3])

    Here is the result.

     

     

    Hope this can help you!

     

     

    Best Regards,

    Cherry

2 Replies

  • Anonymous's avatar
    Anonymous
    Not applicable

    Replace your Field1,2,3 columns with the below formulas.

     

    Filed1_New = IF(TableA[Filed1]=RELATED(TableB[ID]), RELATED(TableB[Desc]))

    Filed2_New = IF(TableA[Filed2]=RELATED(TableB[ID]), RELATED(TableB[Desc]))

    Filed3_New = IF(TableA[Filed3]=RELATED(TableB[ID]), RELATED(TableB[Desc]))

     

     

    Thanks

    Raj

     

  • v-piga-msft's avatar
    v-piga-msft
    Resident Rockstar

    Hi calou_33,

     

    You could have a try with the formulas below.

     

    Column1 = LOOKUPVALUE('TableB'[Desc],TableB[ID],'TableA'[Field1])
    Column2 = LOOKUPVALUE('TableB'[Desc],TableB[ID],'TableA'[FIeld2])
    Column3 = LOOKUPVALUE('TableB'[Desc],TableB[ID],'TableA'[Field 3])

    Here is the result.

     

     

    Hope this can help you!

     

     

    Best Regards,

    Cherry