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

Find everything you need to get certified on Fabric—skills challenges, live sessions, exam prep, role guidance, and more. Get started

Reply
msantillan
Helper II
Helper II

Compare 3 columns from 1 column in another table

Hi, is there a way to add a new column into Table A:

if values from 3 columns in Table A exists in 1 column in Table B,

and the result would be the value from the 1 column in Table B

 

Something like

if ( contains (Table B, Column 1.B, Column 1.A and Column 2.A and Column 3.A), "Column 1.B", null))

 

but above code doesn't work.

 

Thank you.

1 ACCEPTED SOLUTION

I was too concentrated with using contain and lookup, that I forgot the the use of Filter. Here is the solution I was able to come up with, if anyone else has a more simple answer, please feel free to show it:

New Column = CALCULATE(FIRSTNONBLANK('Table 2'[Resource Config],1),
FILTER('Table 2','Table 2'[Resource Config]='Table 1'[Creator]||
'Table 2'[Resource Config]='Table 1'[Assignee]||
'Table 2'[Resource Config]='Table 1[Reporter]))
 
Thanks.

View solution in original post

5 REPLIES 5
amitchandak
Super User
Super User

@msantillan , you need to try like

 

Countx(filter(Table2, CONTAINSSTRING(Table2[Col],Table1[Col1])  && CONTAINSSTRING(Table2[Col1],Table1[Col1]) ),Table2[Col1])

 

Bring results from Table 2 to table1.

 

This will a new column in table 1. any count means you condition matched.

 

https://docs.microsoft.com/en-us/dax/containsstring-function-dax

Hi @amitchandak I don't particularly get the solution. I'm trying to see if the three columns from Table 1 exists in the 1 column in Table 2. I then get the value from the 1 column in Table 2 into a new column in Table 1.

@msantillan ,Can you share sample data and sample output in table format?

Hi @amitchandak I can't send a sample data. But here is the sample output in table format:

 

Table 1:

 

ReporterCreatorAssignee(New Column)
BillMarkBillBill
MarkTomTomTom
James MarkJames

 

Table 2:

 

Resource Config
Bill
Tom
James

 

So, basically Table 1 will check if the names from Table 2 exists in either Reporter, Creator and Assignee. If it exists, the values from Table 2 will be extracted into the new column in Table 1

I was too concentrated with using contain and lookup, that I forgot the the use of Filter. Here is the solution I was able to come up with, if anyone else has a more simple answer, please feel free to show it:

New Column = CALCULATE(FIRSTNONBLANK('Table 2'[Resource Config],1),
FILTER('Table 2','Table 2'[Resource Config]='Table 1'[Creator]||
'Table 2'[Resource Config]='Table 1'[Assignee]||
'Table 2'[Resource Config]='Table 1[Reporter]))
 
Thanks.

Helpful resources

Announcements
July 2024 Power BI Update

Power BI Monthly Update - July 2024

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

PBI_Carousel_NL_June

Fabric Community Update - June 2024

Get the latest Fabric updates from Build 2024, key Skills Challenge voucher deadlines, top blogs, forum posts, and product ideas.

Top Solution Authors