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!Join the Fabric FabCon Global Hackathon—running virtually through Nov 3. Open to all skill levels. $10,000 in prizes! Register now.
Please how can I get the most recent row values if I have a sample data like this.
I used the calculate and filter allexcept function but I got only the dates and not the corresponding Ids.
Table:
patient_name | patient_Id | discharge_date | record_Id |
Mark | 1 | 3/15/2019 | 1001 |
John | 2 | 6/3/2020 | 1002 |
Tom | 3 | 8/7/2020 | 1003 |
Tom | 3 | 9/1/2020 | 1004 |
Tom | 3 | 9/3/2020 | 1005 |
Sarah | 4 | 2/1/2018 | 1006 |
Kim | 5 | 7/6/2017 | 1007 |
Mark | 1 | 4/7/2020 | 1008 |
Tom | 3 | 11/1/2020 | 1009 |
Steve | 6 | 3/2/2019 | 1010 |
Expected Results:
patient_name | patient_Id | discharge_date | record_Id |
John | 2 | 6/3/2020 | 1002 |
Sarah | 4 | 2/1/2018 | 1006 |
Kim | 5 | 7/6/2017 | 1007 |
Mark | 1 | 4/7/2020 | 1008 |
Tom | 3 | 11/1/2020 | 1009 |
Steve | 6 | 3/2/2019 | 1010 |
Thank you so much.
Solved! Go to Solution.
Hi,
I assume you want to create a measure.
Please check the below picture and the attached pbix file.
Date record ID max date: =
IF (
HASONEVALUE ( Data[patient_name] ),
CALCULATE (
MAX ( Data[record_Id] ),
FILTER ( Data, Data[discharge_date] = [Discharge max date:] )
)
)
Hi @yve214 ,
Could you tell me if your problem has been solved? If it is, kindly Accept it as the solution. More people will benefit from it. Or if you are still confused about it, please provide me with more details about your table and your problem or share me with your pbix file after removing sensitive data.
Refer to:
How to provide sample data in the Power BI Forum
How to Get Your Question Answered Quickly
Best Regards,
Jianbo Li
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Hi,
I assume you want to create a measure.
Please check the below picture and the attached pbix file.
Date record ID max date: =
IF (
HASONEVALUE ( Data[patient_name] ),
CALCULATE (
MAX ( Data[record_Id] ),
FILTER ( Data, Data[discharge_date] = [Discharge max date:] )
)
)
Thank you for your help. Sorry I thought I accepted this solution. Thank you again.
Join the Fabric FabCon Global Hackathon—running virtually through Nov 3. Open to all skill levels. $10,000 in prizes!
Check out the September 2025 Power BI update to learn about new features.