Forum Discussion
Return only rows with max value from specific column
- 7 years ago
If you 'Group By' SalesOrderNo and include 'All Rows'
then Expand the table that results.
You will have to remove duplicates and tidy as necessary
If you want to return the row where Version_No is largest.
Table.Max(#"Promoted Headers", "Version_No")
where #"Promoted Headers" is the table.
You can then extract the SalesOrderNo
- MrPingu7 years agoFrequent Visitor
Maybe I didn't fromulat my question well enough.
I want for every disctinct SalesOrderNo. the max version so output should be
SO1 ; 2 ; Datalines
SO2 ; 1 ; Datalines
SO3; 3 ; Datalines- HotChilli7 years agoCommunity Champion
If you 'Group By' SalesOrderNo and include 'All Rows'
then Expand the table that results.
You will have to remove duplicates and tidy as necessary
- Anonymous3 years agoNot applicable
In my opinion, Anonymous's solution below is simpler: simply a) sort table, then b) add an Index, c) filter Index number. I tried Grouping function; I was NOT able to get this to work using standard Group By: the Max command does NOT choose the value ascociated (same row?) with Max of for instance date. The trick is in your last comments; use the All Rows, then 'clean up'. You then need to use a 'Max.Table' command. By which time you are in the weeds of PowerQuery, per this video: How to Group By Maximum Value using Table.Max in Power Query - YouTube