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
evadung
Frequent Visitor

Day with latest time

Hello, 

I have this table. I want to have items with date and latest time. See example.

Any idea how to do it?

ItemDateAmount
A1.3.2023 15:031
A1.3.2023 9:318
A1.3.2023 6:004
A25.2.2023 7:555
A25.2.2023 6:043
B15.2.2023 16:117
B15.2.2023 11:003
B15.2.2023 15:001
C9.2.2023 12:235
C9.2.2023 9:563

 

=>

 

ItemDateAmount
A1.3.2023 15:031
A25.2.2023 7:555
B15.2.2023 16:117
C9.2.2023 12:235
2 REPLIES 2
CNENFRNL
Community Champion
Community Champion

 

let
    Source = Table.FromRows(Json.Document(Binary.Decompress(Binary.FromText("bc7NDcAgCAbQVRrPxgiIVm5txzDuv0axJCZtvcH3wk9r7nDeQaCAEWkDlkgjcN1/qAqB9vtfssSofZqCHNCoCLMGvCCdShrQQ+fYNwmywLhVVgZ2bTnHZvb9pVWdhII0P3lRFc62sN8=", BinaryEncoding.Base64), Compression.Deflate)), let _t = ((type nullable text) meta [Serialized.Text = true]) in type table [Item = _t, Date = _t, Amount = _t]),
    #"Changed Type" = Table.TransformColumnTypes(Source,{{"Item", type text}, {"Date", type datetime}, {"Amount", Int64.Type}}),

    #"Added Dt" = Table.AddColumn(#"Changed Type", "Dt", each Date.From([Date])),
    Grouped = Table.Group(#"Added Dt", "Dt", {"Grp", each Table.Max(_, "Date")}, 0),
    #"Expanded Grp" = Table.RemoveColumns(Table.ExpandRecordColumn(Grouped, "Grp", {"Item", "Date", "Amount"}), "Dt")
in
    #"Expanded Grp"

 

CNENFRNL_0-1677914550356.png


Thanks to the great efforts by MS engineers to simplify syntax of DAX! Most beginners are SUCCESSFULLY MISLED to think that they could easily master DAX; but it turns out that the intricacy of the most frequently used RANKX() is still way beyond their comprehension!

DAX is simple, but NOT EASY!

wdx223_Daniel
Super User
Super User

NewStep=Table.FromRecords(Table.Group(PreviousStepName,"Item",{"n",each Table.Sort(_,{"Date",1}){0}})[n])

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!

December 2025 Power BI Update Carousel

Power BI Monthly Update - December 2025

Check out the December 2025 Power BI Holiday Recap!

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.