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

Calling all Data Engineers! Fabric Data Engineer (Exam DP-700) live sessions are back! Starting October 16th. Sign up.

Reply
aarontanek
Regular Visitor

VLOOKUP with Unmatched Criteria

Hi,

I have 2 tables.  Table 2 is replicated from Table 1 with the below sample data:

 

Table 1 Table 2  
COL 1COL 2COL 1 COL 2COL 3
123A123AX
123B123BY
456A456AZ

 

What I would like to achieve is to vlookup Table 2 with the below criteria:

T1.C1 = T2.C1 and T1.C2 <> T2.C2

 

End result is as per below in column 3.

Table 1  
COL 1COL 2COL 3
123AY
123BX
456A 

 

Is this possible in DAX?

Thank you.

1 ACCEPTED SOLUTION
Cookistador
Super User
Super User

Hi @aarontanek 

 

The following dax code should return what you need

Lookup =
VAR current_col1_T1 = Table1[COL 1]
VAR current_col2_T1 = Table1[COL 2]
VAR matching_rows_in_Table2 =
FILTER (
'Table 2',
'Table 2'[COL 1] = current_col1_T1 &&
'Table 2'[COL 2] <> current_col2_T1
)
RETURN
MAXX(matching_rows_in_Table2, 'Table 2'[COL 3])

 

Cookistador_0-1745825783504.png

 

 

View solution in original post

2 REPLIES 2
Cookistador
Super User
Super User

Hi @aarontanek 

 

The following dax code should return what you need

Lookup =
VAR current_col1_T1 = Table1[COL 1]
VAR current_col2_T1 = Table1[COL 2]
VAR matching_rows_in_Table2 =
FILTER (
'Table 2',
'Table 2'[COL 1] = current_col1_T1 &&
'Table 2'[COL 2] <> current_col2_T1
)
RETURN
MAXX(matching_rows_in_Table2, 'Table 2'[COL 3])

 

Cookistador_0-1745825783504.png

 

 

It works! Thank you so much!

Helpful resources

Announcements
FabCon Global Hackathon Carousel

FabCon Global Hackathon

Join the Fabric FabCon Global Hackathon—running virtually through Nov 3. Open to all skill levels. $10,000 in prizes!

September Power BI Update Carousel

Power BI Monthly Update - September 2025

Check out the September 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.