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

Don't miss out! 2025 Microsoft Fabric Community Conference, March 31 - April 2, Las Vegas, Nevada. Use code MSCUST for a $150 discount. Prices go up February 11th. Register now.

Reply
RandomKitten
Frequent Visitor

Match one column OR another to a different table

Basically, I have a table with data in two columns that I need to match to another table. The problem is, I need to conditionally match this table to another based on whether a column has data.

 

Table 1:

Device NameDevice Code
Product 1ABC123
 XYZ123
Product 2XYZ123
Product 1 
Product 2QRS123

 

Table 2:

ProductCode
Product 1ABC123
Product 2XYZ123

 

I need to check if there is a Device Code, and if so, match it to the Code in Table 2. If there is not, then match the Device Name to the Product in Table 2.  (Obviously there are other columns at play in both tables, but these are the two I need to line up.)

To complicate things further, it would be best if I could check if there is a match to the Device Code, and if there is no match (even if there is a Device Code in Table 1) then compare the Device Name. 

Is it possible to do this?

3 REPLIES 3
v-cherch-msft
Microsoft Employee
Microsoft Employee

Hi @RandomKitten 

You may try to add a column in table1 to check if it match or not.

Column =
IF (
    Table1[Device Code] <> BLANK (),
    IF (
        Table1[Device Code] IN VALUES ( Table2[Code] )
            || Table1[Device Name] IN VALUES ( Table2[Product] ),
        "Match",
        "Not match"
    )
)

a1.png

Regards,

Community Support Team _ Cherie Chen
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

Thank you, @v-cherch-msft.  However, the point of this is not to confirm whether a match exists, but to build a table relationship based on the match.  I apologize if I was unclear on this. 

 

Creating a "Match/No Match" column will not give me the link I need to establish a relationship to the other table so I can pull device information based on the product.

Hi @RandomKitten 

You may link the two columns and try to use USERELATIONSHIP Function.Please have a look at below article.

Reference:https://www.sqlbi.com/articles/userelationship-in-calculated-columns/

Regards,

Community Support Team _ Cherie Chen
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

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! Prices go up Feb. 11th.

Feb2025 Sticker Challenge

Join our Community Sticker Challenge 2025

If you love stickers, then you will definitely want to check out our Community Sticker Challenge!

Jan25PBI_Carousel

Power BI Monthly Update - January 2025

Check out the January 2025 Power BI update to learn about new features in Reporting, Modeling, and Data Connectivity.

Jan NL Carousel

Fabric Community Update - January 2025

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