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

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now! Learn more

Reply
alagator28
Helper II
Helper II

Lookup max value in another column

Hello,

 

I have two tables shown below. I am looking to fill the "Eligible" column of Table1. There is a many to many relationship between the tables. I've been trying to accomplish this using the Lookupvalue function, but I have not been successful. Here are the requirements:

 

For each row in Table 1:

  • Check ALL rows in Table2 matching the Employee found in Table 1
  • If any rows in Table2 have a date which is equal to or greater than the row in Table1, return "Yes"
  • Otherwise, return "No"

 

Table1

EmployeeDateEligible
John Smith12/25/2023Yes
John Smith12/28/2023No

 

Table2

EmployeeDate
John Smith12/21/2023
John Smith12/24/2023
John Smith12/25/2023

 

Any ideas?

 

Thanks in advance.

2 REPLIES 2
Greg_Deckler
Community Champion
Community Champion

@alagator28 Try this:

Eligible Column in Table1 =
  VAR __Employee = 'Table1'[Employee]
  VAR __Date = 'Table1'[Date]
  VAR __Table = FILTER('Table2', [Employee] = __Employee && [Date] >= __Date)
  VAR __Return = IF( __Table = BLANK(), "No", "Yes")
RETURN
  __Return


Follow on LinkedIn
@ me in replies or I'll lose your thread!!!
Instead of a Kudo, please vote for this idea
Become an expert!: Enterprise DNA
External Tools: MSHGQM
YouTube Channel!: Microsoft Hates Greg
Latest book!:
DAX For Humans

DAX is easy, CALCULATE makes DAX hard...

Thank you @Greg_Deckler . Unfortunately, I'm getting the following error: The expression refers to multiple columns. Multiple columns cannot be converted to a scalar value.

 

To troubleshoot this, I entered real values in the variables for __Employee and __Date and I still get the error. It seems to be coming from the __Table variable. I've made sure that the date format is exactly the same, as well as the matching Employee.

Any clues on what I should check? Thanks.

Helpful resources

Announcements
Power BI DataViz World Championships

Power BI Dataviz World Championships

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now!

December 2025 Power BI Update Carousel

Power BI Monthly Update - December 2025

Check out the December 2025 Power BI Holiday Recap!

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.