Forum Discussion
aarontanek
1 year agoRegular 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 1 COL 2 COL 1 COL 2 COL 3 123 A 123 A X 123 B 123 B Y ...
- 1 year ago
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
Super User
1 year agoHi 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])
- aarontanek1 year agoRegular Visitor
It works! Thank you so much!