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

Earn a 50% discount on the DP-600 certification exam by completing the Fabric 30 Days to Learn It challenge.

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
RTI Forums Carousel3

New forum boards available in Real-Time Intelligence.

Ask questions in Eventhouse and KQL, Eventstream, and Reflex.

MayPowerBICarousel

Power BI Monthly Update - May 2024

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

LearnSurvey

Fabric certifications survey

Certification feedback opportunity for the community.