Forum Discussion

Dexter1088's avatar
Dexter1088
Frequent Visitor
7 years ago
Solved

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!

  • 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.

2 Replies

  • 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.

    • Dexter1088's avatar
      Dexter1088
      Frequent Visitor

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