Forum Discussion
RyanL-EIS
9 years agoFrequent Visitor
Latest Record in Group via Query Editor
We are trying to get the latest record/row in a group via Query Editor. After we expand the group and we filter on the latest record, it filters the entire dataset and not within the group. Please ...
MarcelBeug
9 years agoCommunity Champion
The way to go is to adjust the generated code for #"Grouped Rows", more specifically the part each _
Here you can specify the selection.
This should work, but I can't test of course:
#"Grouped Rows" = Table.Group(#"Removed Duplicates", {"settleID", "productionDate"}, {{"SettleID-Statement_Group", each Table.SelectRows(_, let latest = List.Max(_[#"SettleID-Statement_Group.statementDate"]) in each [#"SettleID-Statement_Group.statementDate"] = latest), type table}}),