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
awitt
Helper III
Helper III

Matching to one of many columns in a different table.

I have an orders table that pulls in one address per order. I seperately have an address table that offers multiple variations of a specific address in different columns. My goal is to return a "Y" if the address in the orders table matches any of the addresses in the address table.  These addresses are the store addresses and I'm trying to find how many orders are going to the store vs. the buyers home address.

 

So in this case, two of the orders (1001 & 1002) went to the store address and order 1003 went to a non-store address.  The issue is matching to one of multiple columns in the address table as the same address could have different variations (Road. Rd. Rd) etc.

 

image.png

1 ACCEPTED SOLUTION
v-yuta-msft
Community Support
Community Support

@awitt ,

 

Please refer to steps below:

 

Firstly, click query editor-> select [Store Address], [Store Alt. Address] and other similar columns-> in Transform pane, click Unpivot Columns, then the table will be transformed like below:

1.PNG 

 

Then after close & apply, you can create a calculate column in 'Order Table' using DAX below:

Yes/No = 
VAR Current_ID = 'Order Table'[Company ID]
VAR Current_Value = 'Order Table'[Address]
RETURN
IF(CONTAINS('Store Address Table', 'Store Address Table'[Company ID], Current_ID, 'Store Address Table'[Value], Current_Value), "Y", "N")

The result will be like below:

2.PNG 

Community Support Team _ Jimmy Tao

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

View solution in original post

1 REPLY 1
v-yuta-msft
Community Support
Community Support

@awitt ,

 

Please refer to steps below:

 

Firstly, click query editor-> select [Store Address], [Store Alt. Address] and other similar columns-> in Transform pane, click Unpivot Columns, then the table will be transformed like below:

1.PNG 

 

Then after close & apply, you can create a calculate column in 'Order Table' using DAX below:

Yes/No = 
VAR Current_ID = 'Order Table'[Company ID]
VAR Current_Value = 'Order Table'[Address]
RETURN
IF(CONTAINS('Store Address Table', 'Store Address Table'[Company ID], Current_ID, 'Store Address Table'[Value], Current_Value), "Y", "N")

The result will be like below:

2.PNG 

Community Support Team _ Jimmy Tao

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

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.