Join us at FabCon Atlanta from March 16 - 20, 2026, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.
Register now!The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now! Learn more
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:
Solved! Go to Solution.
@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.
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])
)
)
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:
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.
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 )
)
@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.
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?
@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.
The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now!
| User | Count |
|---|---|
| 39 | |
| 37 | |
| 33 | |
| 32 | |
| 29 |
| User | Count |
|---|---|
| 132 | |
| 88 | |
| 82 | |
| 68 | |
| 64 |