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

Power BI is turning 10! Let’s celebrate together with dataviz contests, interactive sessions, and giveaways. Register now.

Reply
Anonymous
Not applicable

Matching data from two tables not with lookupvalue as there is more than one result

I have two table that I want to do a lookup, but because lookup value only works when on expected value is in the table. This data set however have multipe. Is there any way to do a lookup to have an out put like this.

 

Table 1    
No.NameNumber  
1AB1234  
23ABCD100  
123DFSD1234  
444EFS422  
     
     
Table 2    
No.NameNumber  
12541353SADSAD1234  
12341423DAADFD100  
14345212DAFSASD1234  
     
     
     
New table 1    
No.NameNumber No. Table 2Name Table 2
1AB123412541353SADSAD
1AB123414345212DAFSASD
23ABCD10012341423DAADFD
123DFSD123412541353SADSAD
123DFSD123414345212DAFSASD
444EFS422  
1 ACCEPTED SOLUTION
tamerj1
Super User
Super User

Hi @Anonymous 
Here is a sample file with the solution https://www.dropbox.com/t/2JpsLFnnm9GrWpHL

1.png

 

Table3 = 
UNION (
    GENERATE ( 
        Table1, 
        SELECTCOLUMNS (
            FILTER ( Table2, Table2[Number] = Table1[Number] ),
            "@Name", Table2[Name],
            "@No .", Table2[No.]
        )
    ),
    ADDCOLUMNS (
        FILTER (
            Table1,
            NOT ( Table1[Number] IN VALUES ( Table2[Number] ) )
        ),
        "@Name", "",
        "@No .", ""
    )
)

 

View solution in original post

5 REPLIES 5
Anonymous
Not applicable

@tamerj1thanks again this works briliant. Is it possible to add another filter function to that it is looking for two matches to be true as part of this? -

 FILTER ( Table2, Table2[Number] = Table1[Number] ),
tamerj1
Super User
Super User

Hi @Anonymous 
Here is a sample file with the solution https://www.dropbox.com/t/2JpsLFnnm9GrWpHL

1.png

 

Table3 = 
UNION (
    GENERATE ( 
        Table1, 
        SELECTCOLUMNS (
            FILTER ( Table2, Table2[Number] = Table1[Number] ),
            "@Name", Table2[Name],
            "@No .", Table2[No.]
        )
    ),
    ADDCOLUMNS (
        FILTER (
            Table1,
            NOT ( Table1[Number] IN VALUES ( Table2[Number] ) )
        ),
        "@Name", "",
        "@No .", ""
    )
)

 

Jihwan_Kim
Super User
Super User

Hi,

I am not sure if I understood your question correctly, but please check the below DAX formula.

It is for creating a new table.

 

New_Table = 
VAR _nonumberlistintable2 =
    EXCEPT ( VALUES ( Table1[Number] ), VALUES ( Table2[Number] ) )
VAR _filtertable1 =
    ADDCOLUMNS (
        FILTER ( Table1, Table1[Number] IN _nonumberlistintable2 ),
        "No1.", BLANK (),
        "Name1", BLANK (),
        "Number1", BLANK ()
    )
RETURN
    UNION (
        GENERATE ( ALL ( Table1 ), FILTER ( Table2, Table2[Number] = Table1[Number] ) ),
        _filtertable1
    )


Microsoft MVP



If this post helps, then please consider accepting it as the solution to help other members find it faster, and give a big thumbs up.




LinkedInVisit my LinkedIn page




Outlook BookingSchedule a short Teams meeting to discuss your question



tamerj1
Super User
Super User

Hi @Anonymous 

can you build relationships between the two tables? Are trying to create a new calculated table or just a table visual?

Anonymous
Not applicable

A new calculated table

Helpful resources

Announcements
Join our Fabric User Panel

Join our Fabric User Panel

This is your chance to engage directly with the engineering team behind Fabric and Power BI. Share your experiences and shape the future.

June 2025 Power BI Update Carousel

Power BI Monthly Update - June 2025

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

June 2025 community update carousel

Fabric Community Update - June 2025

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