Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

Get Fabric Certified for FREE during Fabric Data Days. Don't miss your chance! Request now

Reply
Anonymous
Not applicable

Add column based on two related tables

Hi all,

I'm trying to add a new column in a table that lookups in 2 different tables:

 

Table1 contains columns with Table1[ID_1] and Table1[ID_2] (among other columns), in this table I want to add a new column Table1[Product]

 

"Product" should be:

Lookup Table1[ID_1] in Table2 and if Table2[ID_1] exists, then give me the value in the column Table2[Product]

if does not exist-> Lookup Table1[ID_2] in Table3[ID_2] and return me the value in the column Table3[Product]

I´ve tryed the following:

 

Table1[Product] = iferror(related(Table2[Product]);related(Table3[Product]))
 
but the result retunrs an error.
Thank you very much for your support
 
 
1 ACCEPTED SOLUTION
Anonymous
Not applicable

Hi @Anonymous ,

 

Hope you have the relationship between the Table1 --> Table2 and Table1 --> Table 3

 

Try the following as calculated Column in Table1

 

ProductName = IF(ISBLANK(LOOKUPVALUE(Table2[ProductName],Table2[ID ],Table1[ID ])),LOOKUPVALUE(Table3[ProductName],Table3[ID ],Table1[ID ]),LOOKUPVALUE(Table2[ProductName],Table2[ID ],Table1[ID ]))
 
What it does if the LOOKUPVALUE FROM Table2 is blank then get the LOOKUPVALUE FROM Table3 otherwise LOOKUPVALUE FROM Table2.
 
Alternately you can change your formula as under
 
Product = IF (ISBLANK(Related(Table2[ProductName])),Related(Table3[ProductName]),Related(Table2[ProductName]))
 
Cheers
 
CheenuSing
 
 

View solution in original post

2 REPLIES 2
Anonymous
Not applicable

Hi @Anonymous ,

 

Hope you have the relationship between the Table1 --> Table2 and Table1 --> Table 3

 

Try the following as calculated Column in Table1

 

ProductName = IF(ISBLANK(LOOKUPVALUE(Table2[ProductName],Table2[ID ],Table1[ID ])),LOOKUPVALUE(Table3[ProductName],Table3[ID ],Table1[ID ]),LOOKUPVALUE(Table2[ProductName],Table2[ID ],Table1[ID ]))
 
What it does if the LOOKUPVALUE FROM Table2 is blank then get the LOOKUPVALUE FROM Table3 otherwise LOOKUPVALUE FROM Table2.
 
Alternately you can change your formula as under
 
Product = IF (ISBLANK(Related(Table2[ProductName])),Related(Table3[ProductName]),Related(Table2[ProductName]))
 
Cheers
 
CheenuSing
 
 
Anonymous
Not applicable

Thank you very much @Anonymous ! thats exactly what I needed!

Helpful resources

Announcements
Fabric Data Days Carousel

Fabric Data Days

Advance your Data & AI career with 50 days of live learning, contests, hands-on challenges, study groups & certifications and more!

October Power BI Update Carousel

Power BI Monthly Update - October 2025

Check out the October 2025 Power BI update to learn about new features.

FabCon Atlanta 2026 carousel

FabCon Atlanta 2026

Join us at FabCon Atlanta, March 16-20, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.

Top Solution Authors
Top Kudoed Authors