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

Get certified in Microsoft Fabric—for free! For a limited time, get a free DP-600 exam voucher to use by the end of 2024. Register now

Reply
MEHUL123
Frequent Visitor

Create new table by combining 2 tables DAX (not in power query)

Hi,

 

I have 2 tables (non relationship tables)

I am trying to create 3rd separate table where i need to bring ALL available EMP IDs (TABLE 1) against each JOB NOs (table 2) having common CLUB IDs 

 

TABLE1 
CLUB IDEMP ID
ABC123
ABC456
ABC789
AAA001

 

 

TABLE2 
CLUB IDJOB NO
ABCXYZ
ABCLMN
ABCOPQ
AAAXXX
AAAYYY

 

 

 

TABLE3 - Desired Table  
CLUB IDJOB NOEMP ID
ABCXYZ123
ABCXYZ456
ABCXYZ789
ABCLMN123
ABCLMN456
ABCLMN789
ABCOPQ123
ABCOPQ456
ABCOPQ789
AAAXXX001
AAAYYY001

 

Pls help, thanks in advance

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

Hi @MEHUL123 ,

Please try to create a calculated table as below:

TABLE3 = 
SELECTCOLUMNS(
    FILTER(
        CROSSJOIN('TABLE1', 'TABLE2'),
        'TABLE1'[CLUB ID] = 'TABLE2'[CLUB ID]
    ),
    "CLUB ID", 'TABLE1'[CLUB ID],
    "JOB NO", 'TABLE2'[JOB NO],
    "EMP ID", 'TABLE1'[EMP ID]
)

vyiruanmsft_0-1729233662699.png

Best Regards

Community Support Team _ Rena
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

5 REPLIES 5
divyed
Resolver IV
Resolver IV

Hello @MEHUL123 ,

 

Here is the DAX for your reference.

 

T_3 =
VAR JoinedTable =
    FILTER(CROSSJOIN(T_1, T_2),T_1[CLUB_ID] = T_2[CLUB_ID])
RETURN

        SELECTCOLUMNS(
            JoinedTable,
            "CLUB_ID", T_1[CLUB_ID],
            "EMP_ID", T_1[EMP_ID],
            "JOB_NO", T_2[JOB_NO]
        )
       
divyed_0-1729237363436.png

 

If this helps, please mark this as solution. Appreciate Kudos always.

 

Cheers

v-yiruan-msft
Community Support
Community Support

Hi @MEHUL123 ,

Please try to create a calculated table as below:

TABLE3 = 
SELECTCOLUMNS(
    FILTER(
        CROSSJOIN('TABLE1', 'TABLE2'),
        'TABLE1'[CLUB ID] = 'TABLE2'[CLUB ID]
    ),
    "CLUB ID", 'TABLE1'[CLUB ID],
    "JOB NO", 'TABLE2'[JOB NO],
    "EMP ID", 'TABLE1'[EMP ID]
)

vyiruanmsft_0-1729233662699.png

Best Regards

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

Try this :

YourNeTable= 
FILTER(
    CROSSJOIN(Table1, Table2),
    TREATAS(Table1[CLUB ID], Table2[CLUB ID])
)

 



Regards,
Sachin
Check out my Blog

Hi, Thanks for response, however unable to create desired table, request your view on this.

Thanks in advance

Whats the error ?
Rename the column CLUB ID in either of the table from CLUB ID to CLUB_ID

NewTable = 
FILTER(
    CROSSJOIN(
        Table1,
        Table2
    ),
    Table1[CLUB ID] = Table2[CLUB_ID]
)

SachinNandanwar_0-1729193227274.png

 



Regards,
Sachin
Check out my Blog

Helpful resources

Announcements
November Carousel

Fabric Community Update - November 2024

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

Live Sessions with Fabric DB

Be one of the first to start using Fabric Databases

Starting December 3, join live sessions with database experts and the Fabric product team to learn just how easy it is to get started.

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! Early Bird pricing ends December 9th.

Nov PBI Update Carousel

Power BI Monthly Update - November 2024

Check out the November 2024 Power BI update to learn about new features.

Top Solution Authors