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
Mechi
Helper I
Helper I

Compare two tables having multiple text with delimiter

Hello All,

 

 I need a help from the powerbi community members

 

I have two tables, Table 1 has multiple texts separated by comma in rows, Table 2 has texts in columns

Table 1                                                              

Sweets, Vegetables, Fruits, Meat

 

Table 2

Sweets

Vegetables

Fruits

Meat

 

I need to create a new column in Table 1 which should now compare the two tables, if the table 1 row (Sweets, Vegetables, Fruits, Meat) matches with all the text with a specific column in table 2 then  the results should be displayed as "OK"

 

Thanks for your help

Mechi 🔧                 

1 ACCEPTED SOLUTION

Hello Vimal,

 

 Thanks for your effors and support in sharing the knowledge and solutions 😊

Finally we had arrived to a solution using power query, Posted the solution in Power Query Forum, Link to solution

 

BR

Mechi 🔧

View solution in original post

8 REPLIES 8
Anonymous
Not applicable

@Mechi please try concatenatex function

 

Column 2 = IF(CONCATENATEX(Table2,Table2[tbl2Col],", ",Table1[Column])=Table1[Column],"Ok")

 

 

Hi Vimal,

 

 Thanks for your reply and solution

 

I was looking for a solution for the below example (snap), i haven't mentioned in detail in my earlier post

Test.jpg

 

Thanks for the feedback

 

BR

Mechi 🔧

Anonymous
Not applicable

Column = IF(SUMX(Table2,FIND(LOWER(Table2[List 1]),LOWER(Table1[ITEMS]),,0))>0,"Ok","Not Ok")

@Mechi  Please create this column in Table1.

It should compare the each word, but the formula finds & compares the first character and not the words

 

Test1.jpg

Mechi 🔧

Anonymous
Not applicable

Hi @Mechi  Thanks for poiting out that. Fixed that issue. Can you please try below one

 

Column = 
VAR countOfMatchingElement = DIVIDE(LEN(SUBSTITUTE(CONCATENATEX(Table2,CONTAINSSTRING(Table1[ITEMS],Table2[List 1])),"FALSE","")),4,0)
VAR countOfDelimiter = (LEN(Table1[ITEMS])-LEN(SUBSTITUTE(Table1[ITEMS],",","")))+1
RETURN IF((countOfDelimiter-countOfMatchingElement)<>0,"Not ok","Ok")

 

Hi Vimal,

 Thanks for your efforts 👍

 The results are almost close, except the one with exact string match for the last one

  Test2.jpg

 Mechi 🔧

Anonymous
Not applicable

Hi @Nathaniel_C , @Mariusz  Sorry for tagging.
Any input how to resolve this problem

List 1

Sweets
Fruits
Furnitures
Clothes
Vegetables
Meat
Flowers
Toys
Forest

ITEMS

Sweets, Vegetables, Fruits, Meat
Flowers, Toys, Drinks
Furnitures, Clothes
Forests

Hello Vimal,

 

 Thanks for your effors and support in sharing the knowledge and solutions 😊

Finally we had arrived to a solution using power query, Posted the solution in Power Query Forum, Link to solution

 

BR

Mechi 🔧

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.

Top Solution Authors