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
MuppetyMe
Helper I
Helper I

LOOKUPVALUE troubles

I have two tables: Table1 has multiple lines referencing the same ID with teammate names on different dates.
On Table2, I want to bring over the teammate name from the most recent date by the ID. Creating a new column on Table2 with LOOKUPVALUE throws an error because there are multiple entries for the same ID.
Created a measure: 

MOST RECENT Teammate = CALCULATE(FIRSTNONBLANK(Table1[Teammate],1), FILTER(Table1, Table1[Date] = MAX(Table1[Date]))), which does produce results, but not sure how to bring that over to Table2. 
 

MuppetyMe_1-1727380356842.png

 

 

1 ACCEPTED SOLUTION
parry2k
Super User
Super User

@MuppetyMe you can use the following expression to add a new column in the table2, assuming table 1 and table 2 has relationship on ID - one to many

 

Most Recent Teammate = 
CALCULATE ( 
    MAX ( Table1[Teammate] ),
    TOPN ( 
          1,
          RELATEDTABLE ( Table1 ),
          Table1[Date] 
    )
)

 

 



Subscribe to the @PowerBIHowTo YT channel for an upcoming video on List and Record functions in Power Query!!

Learn Power BI and Fabric - subscribe to our YT channel - Click here: @PowerBIHowTo

If my solution proved useful, I'd be delighted to receive Kudos. When you put effort into asking a question, it's equally thoughtful to acknowledge and give Kudos to the individual who helped you solve the problem. It's a small gesture that shows appreciation and encouragement! ❤


Did I answer your question? Mark my post as a solution. Proud to be a Super User! Appreciate your Kudos 🙂
Feel free to email me with any of your BI needs.

View solution in original post

7 REPLIES 7
Kedar_Pande
Super User
Super User

@MuppetyMe ,

In Table2, create a new calculated column

Recent Teammate = 
CALCULATE(
FIRSTNONBLANK(Table1[Teammate], 1),
FILTER(
Table1,
Table1[ID] = Table2[ID] &&
Table1[Date] = CALCULATE(MAX(Table1[Date]), Table1[ID] = Table2[ID])
)
)
Anonymous
Not applicable

Hi @MuppetyMe 

 

Thanks for the reply from parry2k and SachinNandanwar , please allow me to provide another insight:

 

The following measure is for your reference.

Measure = 
VAR _MAXDate = CALCULATE(MAX('Table1'[Date]), 'Table1'[ID] = MAX('Table2'[ID]))
RETURN
CALCULATE(MAX('Table1'[Teammate]), FILTER('Table1', [Date] = _MAXDate))

 

Output:

vxuxinyimsft_0-1727419854830.png

 

Best Regards,
Yulia Xu

 

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

SachinNandanwar
Super User
Super User

Create a calculated column in first table that ranks the record across ID's

 

Rnk = RANKX (
    FILTER (
        'Tbl_',
 
       'Tbl_'[Id]= EARLIER (Tbl_[ID])
    ),
    'Tbl_'[Date],
    , 
    DESC,Dense
)

 


In the second table create a measure that retrieves the top most names across each ID's based on the rank

 

Recent_TeamMate =
CALCULATE (
    MAX ( Tbl_[Name] ),
    FILTER ( RELATEDTABLE ( Tbl_ ), Tbl_[Rnk] = 1 )
)

 

 SachinNandanwar_0-1727387188696.png

 



Regards,
Sachin
Check out my Blog
parry2k
Super User
Super User

@MuppetyMe yes the best practice should be a dimension table with unique values and then it should work.



Subscribe to the @PowerBIHowTo YT channel for an upcoming video on List and Record functions in Power Query!!

Learn Power BI and Fabric - subscribe to our YT channel - Click here: @PowerBIHowTo

If my solution proved useful, I'd be delighted to receive Kudos. When you put effort into asking a question, it's equally thoughtful to acknowledge and give Kudos to the individual who helped you solve the problem. It's a small gesture that shows appreciation and encouragement! ❤


Did I answer your question? Mark my post as a solution. Proud to be a Super User! Appreciate your Kudos 🙂
Feel free to email me with any of your BI needs.

MuppetyMe
Helper I
Helper I

Hi @parry2k, unfortunately, it's a Many to Many relationship between the 2 tables 😞 Might it be best to create a whole different table with unique IDs, then bring in the MAX, TOPN teammate? 

parry2k
Super User
Super User

@MuppetyMe you can use the following expression to add a new column in the table2, assuming table 1 and table 2 has relationship on ID - one to many

 

Most Recent Teammate = 
CALCULATE ( 
    MAX ( Table1[Teammate] ),
    TOPN ( 
          1,
          RELATEDTABLE ( Table1 ),
          Table1[Date] 
    )
)

 

 



Subscribe to the @PowerBIHowTo YT channel for an upcoming video on List and Record functions in Power Query!!

Learn Power BI and Fabric - subscribe to our YT channel - Click here: @PowerBIHowTo

If my solution proved useful, I'd be delighted to receive Kudos. When you put effort into asking a question, it's equally thoughtful to acknowledge and give Kudos to the individual who helped you solve the problem. It's a small gesture that shows appreciation and encouragement! ❤


Did I answer your question? Mark my post as a solution. Proud to be a Super User! Appreciate your Kudos 🙂
Feel free to email me with any of your BI needs.

Thank you @parry2k. Once I introduced a table without repeating IDs and created a one to many cardinality, this solution worked. 

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!

November Power BI Update Carousel

Power BI Monthly Update - November 2025

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