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

Earn a 50% discount on the DP-600 certification exam by completing the Fabric 30 Days to Learn It challenge.

Reply
mmadiganjr
Frequent Visitor

How to show value for the most recent date for each individual

Trying to show the value (bodyweight) for the most recent date for each individual, and if they don't have a weight for the most recent date in the data it will still pull from the last time they weighed in. Recently created a measure that worked but wouldn't show the ones that didn't have a weight for the most recent date, & hitting a roadblock with my current measure. power bi formula.PNGpower bi data.png

3 REPLIES 3
lbendlin
Super User
Super User

You need to compute the "most recent date" for each individual separately (for example via SUMMARIZE).

 

Please provide sample data (with sensitive information removed) that covers your issue or question completely, in a usable format (not as a screenshot).
https://community.fabric.microsoft.com/t5/Community-Blog/How-to-provide-sample-data-in-the-Power-BI-...
Please show the expected outcome based on the sample data you provided.

https://community.fabric.microsoft.com/t5/Desktop/How-to-Get-Your-Question-Answered-Quickly/m-p/1447...

Hi @lbendlin 
I am interested in this solution too , so i prepared a sample table:
MemberDateValue

a01/02/2023996
b02/02/2023690
c03/02/2023243
d04/02/2023127
e05/02/2023395
f06/02/2023250
a07/02/2023127
b08/02/2023406
c09/02/2023750
d10/02/2023625
e11/02/2023923
f12/02/2023 
a13/02/2023222
b14/02/2023622
c15/02/2023201
d16/02/2023151
e17/02/2023828
f18/02/2023751
a19/02/2023567
b20/02/2023 
c21/02/2023741
d22/02/2023837
e23/02/2023755
f24/02/2023 
a25/02/2023748
b26/02/2023894
c27/02/2023112
d28/02/202353
e01/03/2023202
f02/03/2023975
a03/03/2023651
b04/03/2023112
c05/03/2023 
d06/03/2023504
e07/03/2023437
f08/03/2023600
a09/03/2023825
b10/03/202361
c11/03/2023992
d12/03/2023 
e13/03/2023922
f14/03/2023393
a15/03/2023784
b16/03/2023500
c17/03/2023173
d18/03/2023716
e19/03/2023 
f20/03/2023946
a21/03/2023976
b22/03/202387
c23/03/2023995
d24/03/2023933
e25/03/202328
f26/03/202371
a27/03/2023476
b28/03/2023919
c29/03/2023 
d30/03/2023919
e31/03/2023534
f01/04/2023432
a02/04/2023323
b03/04/2023498
c04/04/2023758
d05/04/2023523
e06/04/2023818
f07/04/2023611
a08/04/2023537
b09/04/202356
c10/04/2023 
d11/04/2023697
e12/04/2023842
f13/04/2023304
a14/04/2023148
b15/04/2023732
c16/04/2023 
d17/04/202391
e18/04/202395
f19/04/2023314

Power Query version:

let
    Source = Table.FromRows(Json.Document(Binary.Decompress(Binary.FromText("bZVLbsJAEESvEnmNlOnPfPosKIsQ4P5HCOO0XDUxSyjjea9dbq7X7Xu7bEU+i35qUXt9iGjb1+W63WagFLQoe/AzA6NA3fbgPgOnQLTvwWMGlQKLugfPGTS+Vf07Y6fqb261Uw0KvDRQBQU9bzWppLCH1oNKFnO1g0rY/ONgksVb9WASX07Qg0nYW4uAib2lCpjYe+gA01j0BFTsXRsmpeVkMZmUrbuDSdl6GJ6e2nI0np762zlpXU4YIGLrEQ6m5WmLgomtq6FQLwnDYBWFUgqiVxTKKGg5v1uW1v6f/ZOltdXunpU9vq7FwdQp8JzfMyuLowuVPCgY2cxbVha/EPSJtSMwJ9ET6yMbi+sVYxKWtjC0iaX7cCCt2tgGwtrSsQ2Etbs0UMUJ9pl9Baw39Gmx7thQytajo06Ldq6bexYWgaFPytr01mlbHIC0PGtGYumQANNZehJZeXP9JDKWruZo0ytw1EzRJqXAcp3dsvr4RQw03CnodaDjlYKq9N41CoZgULP8jsZiUrP8uJXRIg8OsMdn9/08KGHtFthOwtrDqeOsbfmifmf5j0BoPwlrd6M93t4zsXTQEmdn+rcTVjZ5EX39Ag==", BinaryEncoding.Base64), Compression.Deflate)), let _t = ((type nullable text) meta [Serialized.Text = true]) in type table [Member = _t, Date = _t, Value = _t]),
    #"Changed Type" = Table.TransformColumnTypes(Source,{{"Member", type text}, {"Date", type date}, {"Value", Int64.Type}},"en-GB"),
    #"Grouped Rows" = Table.Group(#"Changed Type", {"Member"}, {{"Rows", each _, type table [Member=nullable text, Date=nullable text, Value=nullable number]}}),
    #"Added Custom" = Table.AddColumn(#"Grouped Rows", "Last Weight", each Table.Sort(Table.SelectRows([Rows], each ([Value] <> null)),{{"Date", Order.Descending}})[Value]{0},type number),
    #"Removed Other Columns" = Table.SelectColumns(#"Added Custom",{"Member", "Last Weight"})
in
    #"Removed Other Columns"

Measure:

lbendlin_0-1686607978027.png

This can be refactored in a couple of ways.

Helpful resources

Announcements
RTI Forums Carousel3

New forum boards available in Real-Time Intelligence.

Ask questions in Eventhouse and KQL, Eventstream, and Reflex.

MayPowerBICarousel

Power BI Monthly Update - May 2024

Check out the May 2024 Power BI update to learn about new features.

LearnSurvey

Fabric certifications survey

Certification feedback opportunity for the community.