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

Join us at FabCon Atlanta from March 16 - 20, 2026, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM. Register now.

Reply
SkewedCircle
New Member

How to get data in a table based on condition from column from different table

Hi, hope everyone is doing well. I'm new to Power BI and need community's help regarding a problem.

I've two tables which are unrelated as such. Table1 (IED) has a column (Attribute:name) that contains text such as B710_BCU, B710_21_1, etc. Table2 (IED_MP) has a column (TelegramPrefix) that contains several text with text of IED[Attribute:name] as prefix such as B710_BCUabc,  B710_BCUefg, B710_21_1qrs, B710_21_1mnp, etc. I wish to create a new column IED_MP[IEDname] in Table2 with only the data of table1 column IED[Attribute:name] that is contained in Table2 column IED_MP[TelegramPrefix]. The text of each row of IED_MP[TelegramPrefix] is to be checked and matched with text of all rows of  IED[Attribute:name]. If text of IED_MP[TelegramPrefix] begins with any text in IED[Attribute:name] then that text of IED[Attribute:name] is to be added in same row in new column IED_MP[IEDname]. It is to be automated, so DAX code is needed.

Table1:

IED[Attribute:name]
B710_BCU
B710_21_1
B711_BCU

 

Table2:

IED_MP[TelegramPrefix]IED_MP[IEDname]- Expected output
B710_BCUAnUn_MeasTransdInB710_BCU
B710_BCUApplicationB710_BCU
B710_BCUVI3p1_5051OC3phA1B710_BCU
B710_21_1PROTB710_21_1

 

Excel sheet and pbix files are attached at following link for reference:

https://drive.google.com/drive/folders/1hpLf3B9rmT1fCk7fgoeA3KFrumkhKsZ8?usp=sharing

 

Thanks a lot in advance for much needed help.

1 ACCEPTED SOLUTION
dharmendars007
Super User
Super User

Hello @SkewedCircle , 

 

Please try the below DAX codeby creating a calculated column, this should work..

 

IEDname = VAR PrefixValue = IED_MP[TelegramPrefix]
RETURN
MAXX(FILTER(Table1,LEFT(PrefixValue,
LEN(Table1[Attribute:name])) = Table1[Attribute:name]),Table1[Attribute:name])

 

dharmendars007_0-1727010536994.png

 

If you find this helpful , please mark it as solution which will be helpful for others and Your Kudos/Likes are much appreciated!

 

Thank You

Dharmendar S

LinkedIN 

 

View solution in original post

1 REPLY 1
dharmendars007
Super User
Super User

Hello @SkewedCircle , 

 

Please try the below DAX codeby creating a calculated column, this should work..

 

IEDname = VAR PrefixValue = IED_MP[TelegramPrefix]
RETURN
MAXX(FILTER(Table1,LEFT(PrefixValue,
LEN(Table1[Attribute:name])) = Table1[Attribute:name]),Table1[Attribute:name])

 

dharmendars007_0-1727010536994.png

 

If you find this helpful , please mark it as solution which will be helpful for others and Your Kudos/Likes are much appreciated!

 

Thank You

Dharmendar S

LinkedIN 

 

Helpful resources

Announcements
Fabric Data Days Carousel

Fabric Data Days

Advance your Data & AI career with 50 days of live learning, contests, hands-on challenges, study groups & certifications and more!

October Power BI Update Carousel

Power BI Monthly Update - October 2025

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

FabCon Atlanta 2026 carousel

FabCon Atlanta 2026

Join us at FabCon Atlanta, March 16-20, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.