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

Get certified in Microsoft Fabric—for free! For a limited time, get a free DP-600 exam voucher to use by the end of 2024. Register now

Reply
DikshaT
Regular Visitor

Search in a text column for values in another table Column using DAX and map the values

Hello,
I've two tables Masterdata and Regions. Masterdata has a column called 'consolidated Region' and Region table has only one column 'Regions'. This table contains unique values of region.
sample of data is like:

Masterdata==>

offerConsolidated Region
1AMN EUS EUN
2AMN EUS,EUN
3EUS
4AMN
5AMN
6AMN
7EUN UK DACH
8EUS, EUN, CHN
9EUS, EUN, AMN
10EUS, EUN, AMN
11EUS IB

 

Region Table==>

Regions
EUS
EUN
EUC
AMN
AMC
AMS
E2A
AIM

CHN

I want to create a new column in Region table. The value of corresponding 'consolidated Region' should get mapped with 'Regions' if the 'Regions' value exist in the string of 'Consolidated Region'.


sample of Desired Result ==>

 

RegionsCalculated column
EUSAMN EUS EUN
EUSAMN EUS,EUN
EUSEUS
EUSEUS, EUN, CHN
EUSEUS, EUN, AMN
EUSEUS, EUN, AMN
EUSEUS IB
EUNAMN EUS EUN
EUNAMN EUS,EUN
EUNEUS, EUN, CHN
EUNEUS, EUN, AMN
EUNEUS, EUN, AMN
EUCNull
AMNAMN EUS EUN

 

Could anyone help with the same?

1 ACCEPTED SOLUTION
Ahmedx
Super User
Super User
5 REPLIES 5
Ahmedx
Super User
Super User

Thank You so much. This is exactly what I was looking for. Thanks a lot😇

bharath_v
Resolver I
Resolver I

Hi @DikshaT 

 

The desired output seems a bit ambiguous.
Eg: For EUS, there are 4 different values how is it derived? Also you mentioned "Region" table is unique then why do you have 4 rows of EUS?

RegionsCalculated column
EUSAMN EUS EUN
EUSEUS
EUSEUS, EUN, CHN
EUSEUS IB


Can you confirm if this is what you want?

Hello,

 

Region will not be unique in the result. The Idea is to pick a value from 'Region' table and check in 'Consolidated Region', If this Region value is present in Consolidated value then Map consolidated value in front of Region value.
And this process should iterate over all the rows of 'Consolidated Region' column for each row of 'Regions' Column.

Yes at last we will have some duplicate rows in output table, but I'll remove it.

Helpful resources

Announcements
November Carousel

Fabric Community Update - November 2024

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

Live Sessions with Fabric DB

Be one of the first to start using Fabric Databases

Starting December 3, join live sessions with database experts and the Fabric product team to learn just how easy it is to get started.

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! Early Bird pricing ends December 9th.

Nov PBI Update Carousel

Power BI Monthly Update - November 2024

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