Forum Discussion
stribor45
Post Prodigy
1 year agoSelecting Rows by Max Date and something else
I have table where multiple rows with same ID may exist but with different or sometimes same values in Date column. Of course I can group this by ID and select ones with MAX date however since some...
- 1 year ago
Table.FromRecords( Table.Group(Source, "id", {"recs", (x) => Table.Max(x, {"Date", (w) => - w[Decision column]})})[recs] )
speedramps
Super User
1 year agoHere is a Power Query solution as question.
Please please please click thumbs up. I deserve it !
Also clcik [accept solution] it is works (which it does)
Create you test data
Create a new table which referfnces your original table
Group it by ID with Max date
Merge as new query (to crate a new table)
using ID and Date
with a Right Outer join (all from second, matching the first)
Reference that table to create a new table
Group it by ID with min decision
Merge as new query (to create a new table)
join using ID and Decision
with a Right outer hoin
It works in the reports
Download the PBIX from Onedrive here
Note that my solution returns the correct value for ID 88888.
Please check that other member's solutions also handle that tricky scenario