March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount! Early bird discount ends December 31.
Register NowBe one of the first to start using Fabric Databases. View on-demand sessions with database experts and the Microsoft product team to learn just how easy it is to get started. Watch 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:] )
)
)
If this post helps, then please consider accepting it as the solution to help other members find it faster, and give a big thumbs up.
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:] )
)
)
If this post helps, then please consider accepting it as the solution to help other members find it faster, and give a big thumbs up.
Thank you for your help. Sorry I thought I accepted this solution. Thank you again.
March 31 - April 2, 2025, in Las Vegas, Nevada. Use code MSCUST for a $150 discount!
User | Count |
---|---|
27 | |
17 | |
16 | |
12 | |
11 |
User | Count |
---|---|
38 | |
29 | |
22 | |
20 | |
18 |