Forum Discussion
calou_33
8 years agoNew Member
Multiple column with foreign key
Hello,
I have a table A like this
| ID | Field0 | Field1 | FIeld2 | Field 3 |
| 1 | tt | 1 | 1 | 1 |
| 2 | xx | 2 | 2 | 2 |
| 3 | cc | 1 | 2 | 1 |
| 4 | dd | 2 | 2 | 1 |
| 5 | yy | 1 | 1 | 1 |
| 6 | aa | 1 | 1 | 1 |
Table B as :
| ID | Desc |
| 1 | YES |
| 2 | NO |
In Power BI how can i do to have a result like this :
| ID | Field0 | Field1 | FIeld2 | Field 3 |
| 1 | tt | YES | YES | YES |
| 2 | xx | NO | NO | NO |
| 3 | cc | YES | NO | YES |
| 4 | dd | NO | NO | YES |
| 5 | yy | YES | YES | YES |
| 6 | aa | YES | YES | 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
- AnonymousNot 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-msftResident 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