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

Be one of the first to start using Fabric Databases. View on-demand sessions with database experts and the Microsoft product team to learn just how easy it is to get started. Watch now

Reply
manoj619
New Member

need to match data from a different table that includes the text of the current table column

I have a sysid and a status column in table 1, and I need to search for and retrieve data from table 2's sysid column that includes the text from table 1's sysid column
manoj619_0-1677330160543.png

Expecting output

manoj619_1-1677330193518.png

 

8 REPLIES 8
pankaj_lp
Helper I
Helper I

1. In the power query, split the first column.

2. Create two duplicates of the table.
3. Delete the first splitted column in the first table and delete the second splitted column in the second table.
4. Append as a new quesry , the duplicates of the table by renaming as same column name.
5. Delete the duplicates.
6. Make the new relaationship between the appended table and the table2.
7. filter the blank values in the id.

AmiraBedh
Most Valuable Professional
Most Valuable Professional

Try the following :

FILTER(
Table2,
SEARCH(
MAX(Table1[sysid]),
Table2[sysid],
,
0
) > 0
)

 

The MAX function will get the maximum value of the sysid column in Table1, assuming that each sysid appears only once in Table1. 

The SEARCH function will search for the sysid text in the sysid column of Table2. If the sysid text is found, the function returns value different from 0, which is used to filter Table2 using the FILTER function.

 

Be careful with the SEARCH function since it is case-sensitive, so if you want to perform a case-insensitive search, using FIND can be an alternative.


Proud to be a Power BI Super User !

Microsoft Community : https://docs.microsoft.com/en-us/users/AmiraBedhiafi
Linkedin : https://www.linkedin.com/in/amira-bedhiafi/
StackOverflow : https://stackoverflow.com/users/9517769/amira-bedhiafi
C-Sharp Corner : https://www.c-sharpcorner.com/members/amira-bedhiafi
Power BI Community :https://community.powerbi.com/t5/user/viewprofilepage/user-id/332696

Thanks for the reply,

but, i am getting error like this when I tried

manoj619_0-1677396882992.png

 

AmiraBedh
Most Valuable Professional
Most Valuable Professional

I tried to reproduce what you provided in the screenshot. You need to create a calculated table like below : 

Table 2 = FILTER('Second Table', CONTAINS('First Table', 'First Table'[sysid], 'Second Table'[sysid]))
AmiraBedh_0-1677401705052.png

 

I am attaching the PBI file.


Proud to be a Power BI Super User !

Microsoft Community : https://docs.microsoft.com/en-us/users/AmiraBedhiafi
Linkedin : https://www.linkedin.com/in/amira-bedhiafi/
StackOverflow : https://stackoverflow.com/users/9517769/amira-bedhiafi
C-Sharp Corner : https://www.c-sharpcorner.com/members/amira-bedhiafi
Power BI Community :https://community.powerbi.com/t5/user/viewprofilepage/user-id/332696

I tried again, but if there are multiple texts in the column table, it fails.

manoj619_0-1677404127201.png

findtext.pbix

AmiraBedh
Most Valuable Professional
Most Valuable Professional

You are trying to create a calculated column while in the solution I provided it is a calculated table

Can you provide your expected output ?


Proud to be a Power BI Super User !

Microsoft Community : https://docs.microsoft.com/en-us/users/AmiraBedhiafi
Linkedin : https://www.linkedin.com/in/amira-bedhiafi/
StackOverflow : https://stackoverflow.com/users/9517769/amira-bedhiafi
C-Sharp Corner : https://www.c-sharpcorner.com/members/amira-bedhiafi
Power BI Community :https://community.powerbi.com/t5/user/viewprofilepage/user-id/332696

Same error for calculated table also
expected output:

manoj619_0-1677412034752.png

I am attaching the PBI file.

https://1drv.ms/u/s!AsAyziJRKwR0j2sYl-N_7n9TGun8?e=oauTUG

AmiraBedh
Most Valuable Professional
Most Valuable Professional

Based on the PBI file you provided : 

Table 1 :

AmiraBedh_0-1677492366235.png

Table 2 : 

 

AmiraBedh_1-1677492385974.png

 

 

the output will only contain data for the row with sysid=KLS in the table 2 and the status will be DONE.

The other rows will have status null as there is no matching between sysid from Table1 and syside from Table2 for the values HGF, KNF, JKO, IOK 


Proud to be a Power BI Super User !

Microsoft Community : https://docs.microsoft.com/en-us/users/AmiraBedhiafi
Linkedin : https://www.linkedin.com/in/amira-bedhiafi/
StackOverflow : https://stackoverflow.com/users/9517769/amira-bedhiafi
C-Sharp Corner : https://www.c-sharpcorner.com/members/amira-bedhiafi
Power BI Community :https://community.powerbi.com/t5/user/viewprofilepage/user-id/332696

Helpful resources

Announcements
Las Vegas 2025

Join us at the Microsoft Fabric Community Conference

March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount!

November Carousel

Fabric Community Update - November 2024

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

Dec Fabric Community Survey

We want your feedback!

Your insights matter. That’s why we created a quick survey to learn about your experience finding answers to technical questions.