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

Enhance your career with this limited time 50% discount on Fabric and Power BI exams. Ends August 31st. Request your voucher.

Reply
Anonymous
Not applicable

Conditional Column if value exists in a column in a related table

Hello All,

 

I have two tables Table A which has basic values and an empty 'Status' column and Table B which contains multiple rows with values ranging from 1-4 (Status numbers). Both tables are related.

 

I am looking to populate the empty column in Table A with a value ranging from 1-3 based on if a value exists in Table B[Value].

 

eg. if Table B[Value] contains 1 then Table A[Status] = 1,

        else if Table B[Value] contains 2 and not 1 then Table A[Status] = 2,

        else  Table B[Value] contains 3 and not 1 or 2 then Table A[Status] = 3

 

Please reach out if you have any questions and any help at all is appreciated. Thank you.

 

1 ACCEPTED SOLUTION
amitchandak
Super User
Super User

@Anonymous , Try a new column like

 

new column =
var _st = minx(relatedtable(TableB),TableB[Value]) //or // related(TableB[Value])
return
switch(true() ,
search("1",_st,,0) >0, 1,
search("2",_st,,0) >0, 2,
search("3",_st,,0) >0, 3,
4)

Share with Power BI Enthusiasts: Full Power BI Video (20 Hours) YouTube
Microsoft Fabric Series 60+ Videos YouTube
Microsoft Fabric Hindi End to End YouTube

View solution in original post

2 REPLIES 2
amitchandak
Super User
Super User

@Anonymous , Try a new column like

 

new column =
var _st = minx(relatedtable(TableB),TableB[Value]) //or // related(TableB[Value])
return
switch(true() ,
search("1",_st,,0) >0, 1,
search("2",_st,,0) >0, 2,
search("3",_st,,0) >0, 3,
4)

Share with Power BI Enthusiasts: Full Power BI Video (20 Hours) YouTube
Microsoft Fabric Series 60+ Videos YouTube
Microsoft Fabric Hindi End to End YouTube
Anonymous
Not applicable

Hello @amitchandak ,

 

This seems to be working well now. 

 

Thank you very much for the quick response! 

Helpful resources

Announcements
July 2025 community update carousel

Fabric Community Update - July 2025

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

July PBI25 Carousel

Power BI Monthly Update - July 2025

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