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

Preparing for a certification exam? Ask exam experts all your questions on May 15th. 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
Anonymous
Not applicable

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

View solution in original post

5 REPLIES 5
divyed
Super User
Super User

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

LinkedIn : https://www.linkedin.com/in/neeraj-kumar-62246b26/
Anonymous
Not applicable

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

SachinNandanwar
Super User
Super User

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
PBIApril_Carousel

Power BI Monthly Update - April 2025

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

Notebook Gallery Carousel1

NEW! Community Notebooks Gallery

Explore and share Fabric Notebooks to boost Power BI insights in the new community notebooks gallery.

April2025 Carousel

Fabric Community Update - April 2025

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

Top Kudoed Authors