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

Register now to learn Fabric in free live sessions led by the best Microsoft experts. From Apr 16 to May 9, in English and Spanish.

Reply
Dexter1088
Regular Visitor

Add New Column to Table using 2 IF Statements...

Hi There, 
I been trying to find the answer to this with no luck and I know I'm just overlooking the obvious. 

 

My 2 tables look like this

Table 1		
ID	Project	Status
1	Build	Pending
2	Walk	Complete
3	Build	Pending
4	Walk	Complete
5	Walk	Pending
		
Table 2		
ID	Project	
1	Build	
2	Build	
1	Walk	
4	Build	
3	Walk	
3	Build	
4	Walk	
5	Build	
5	Walk	
2	Walk	

I already have a relationship built betweed the table ID's but I can't add a 2nd relationship with the "Project" column.
I Need to add a column to table 2 that will make sure the Table ID & Project match to add the status. 

Any help would be greatly appreciated!, Thanks!

1 ACCEPTED SOLUTION
jdbuchanan71
Super User
Super User

Hello @Dexter1088 

You can pull the value over using the following as a calculated column in Table2.

Status Lookup = LOOKUPVALUE(Table1[Status],Table1[ID],Table2[ID],Table1[Project],Table2[Project])

You could also create a calculated column in both Table1 and Table2 that combines ID and Project into a single field an join the two tables on that.

join key.jpg

View solution in original post

2 REPLIES 2
jdbuchanan71
Super User
Super User

Hello @Dexter1088 

You can pull the value over using the following as a calculated column in Table2.

Status Lookup = LOOKUPVALUE(Table1[Status],Table1[ID],Table2[ID],Table1[Project],Table2[Project])

You could also create a calculated column in both Table1 and Table2 that combines ID and Project into a single field an join the two tables on that.

join key.jpg

works perfect!
I was trying the same thing just had my tables out of order. Thanks!

 

Helpful resources

Announcements
Microsoft Fabric Learn Together

Microsoft Fabric Learn Together

Covering the world! 9:00-10:30 AM Sydney, 4:00-5:30 PM CET (Paris/Berlin), 7:00-8:30 PM Mexico City

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

Check out the April 2024 Power BI update to learn about new features.

April Fabric Community Update

Fabric Community Update - April 2024

Find out what's new and trending in the Fabric Community.