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

Get Fabric Certified for FREE during Fabric Data Days. Don't miss your chance! Request now

Reply
wlknsnBI
Helper II
Helper II

Joining Tables multiple Keys in DAX

Hi,

 

I'm looking for the following join of tables based on multiple keys, preferrably in DAX (not power query):

 

join.jpg

 

So based on GROUP & TYPE for each LINE, PRODUCT is joined.

 

1 ACCEPTED SOLUTION
Mariusz
Community Champion
Community Champion

Hi @wlknsnBI 

 

If you are looking to output a table then Power Query would be more efficient.

If you are looking to create a relationship between these two tables then you can concatenate these two columns and later create a relationship.
If you just need it for a Measure you can use TREATS 

if you need to calculate a table then you can use this code.

Table = 
GENERATE(
    Table1,
    VAR __group = Table1[Group]
    VAR __type = Table1[Type]
    RETURN 
    SELECTCOLUMNS(
        FILTER( 
            Table2,
            Table2[Group] = __group 
            && Table2[Type] = __type
        ),
        "Line", Table2[Line]
    )
)

 

Best Regards,
Mariusz

If this post helps, then please consider Accepting it as the solution.

Please feel free to connect with me.
LinkedIn

 

 

View solution in original post

2 REPLIES 2
Mariusz
Community Champion
Community Champion

Hi @wlknsnBI 

 

If you are looking to output a table then Power Query would be more efficient.

If you are looking to create a relationship between these two tables then you can concatenate these two columns and later create a relationship.
If you just need it for a Measure you can use TREATS 

if you need to calculate a table then you can use this code.

Table = 
GENERATE(
    Table1,
    VAR __group = Table1[Group]
    VAR __type = Table1[Type]
    RETURN 
    SELECTCOLUMNS(
        FILTER( 
            Table2,
            Table2[Group] = __group 
            && Table2[Type] = __type
        ),
        "Line", Table2[Line]
    )
)

 

Best Regards,
Mariusz

If this post helps, then please consider Accepting it as the solution.

Please feel free to connect with me.
LinkedIn

 

 

amitchandak
Super User
Super User

Try if this can help

https://radacad.com/append-vs-merge-in-power-bi-and-power-query

 

In Dax you have to use crossjoin

new Tbl =
filter(crossjoin(selectcolumn(table1,"Grp1",Table1[group],"Prd1",Table1[Product],"Type1",Table1[Product],"Price1",Table1[Price]),table2),
[Grp1]=Table2[Group] && [Type1] = Table2[Type])

 

Share with Power BI Enthusiasts: Full Power BI Video (20 Hours) YouTube
Microsoft Fabric Series 60+ Videos YouTube
Microsoft Fabric Hindi End to End YouTube

Helpful resources

Announcements
Fabric Data Days Carousel

Fabric Data Days

Advance your Data & AI career with 50 days of live learning, contests, hands-on challenges, study groups & certifications and more!

October Power BI Update Carousel

Power BI Monthly Update - October 2025

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

FabCon Atlanta 2026 carousel

FabCon Atlanta 2026

Join us at FabCon Atlanta, March 16-20, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.

Top Solution Authors