cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Highlighted
Helper II
Helper II

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

Accepted Solutions
Highlighted
Community Support
Community Support

Re: Matching to one of many columns in a different table.

@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
Highlighted
Community Support
Community Support

Re: Matching to one of many columns in a different table.

@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

Helpful resources

Announcements
Super Users of the Quarter - Q2 2020

Super Users of the Quarter - Q2 2020

Who are our Super User Superstars? Who made it to the top of the leaderboards? Get the answers!

June 2020 Community Highlights

June 2020 Community Highlights

Featured community members, changes to the Community, and more! Read up on recent Power BI community news.

Community Summit North America

Community Summit North America

Innovate, Collaborate, Grow. The top training and networking event across the globe for Microsoft Business Applications

Power Platform 2020 release wave 2 plan

Power Platform 2020 release wave 2 plan

Features releasing from October 2020 through March 2021

Top Solution Authors
Top Kudoed Authors