Reply
monishd
Frequent Visitor
Partially syndicated - Outbound

Merge a table 2 times to another table to get 2 different columns

Is there a more straightforward way to merge two tables two times with different columns and get new columns based on the match? Can I achieve the below result in one merge or will I have to go for two merge?

 

I have a table 1:

ItemOpenedClosed

I1

XYZXYZ
I2ABCXYZ
I3PQRPQR
I4PQRXYZ

 

table 2:

EmployeeType
ABCManual
PQRSystem
XYZ

System

 

The new table I want should be like:

ItemOpened

Opened By

ClosedClosed By

I1

XYZSystemXYZSystem
I2ABCManualXYZSystem
I3PQRSystemPQRSystem
I4PQRSystemABCManual
1 ACCEPTED SOLUTION
Irwan
Super User
Super User

Syndicated - Outbound

hello @monishd 

 

please check if this accomodate your need.

 

based on the result table your show, i think you want to find a 'Type' value based on matched 'Employee' value (not table merge).

 

But please correct me if i am wrong (since i am not sure why I4 has ABC in 'ByClosed' instead of XYZ as shown in 'Table 1').

 

1. in your table 1, create a calculated column for 'Opened by' with following DAX.

Opened by = 
MAXX(
    FILTER(
        'Table 2',
        'Table 1'[Opened]='Table 2'[Employee]
    ),
    'Table 2'[Type]
)
Irwan_0-1724892481970.png

 

2. again, create a calculated column for 'Closed by' with following DAX.

Closed by =
MAXX(
    FILTER(
        'Table 2',
        'Table 1'[Closed]='Table 2'[Employee]
    ),
    'Table 2'[Type]
)

Irwan_1-1724892549437.png

 

Hope this will help.

Thank you.

View solution in original post

1 REPLY 1
Irwan
Super User
Super User

Syndicated - Outbound

hello @monishd 

 

please check if this accomodate your need.

 

based on the result table your show, i think you want to find a 'Type' value based on matched 'Employee' value (not table merge).

 

But please correct me if i am wrong (since i am not sure why I4 has ABC in 'ByClosed' instead of XYZ as shown in 'Table 1').

 

1. in your table 1, create a calculated column for 'Opened by' with following DAX.

Opened by = 
MAXX(
    FILTER(
        'Table 2',
        'Table 1'[Opened]='Table 2'[Employee]
    ),
    'Table 2'[Type]
)
Irwan_0-1724892481970.png

 

2. again, create a calculated column for 'Closed by' with following DAX.

Closed by =
MAXX(
    FILTER(
        'Table 2',
        'Table 1'[Closed]='Table 2'[Employee]
    ),
    'Table 2'[Type]
)

Irwan_1-1724892549437.png

 

Hope this will help.

Thank you.

avatar user

Helpful resources

Announcements
March PBI video - carousel

Power BI Monthly Update - March 2025

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

March2025 Carousel

Fabric Community Update - March 2025

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

Top Solution Authors (Last Month)
Top Kudoed Authors (Last Month)