Forum Discussion
Mythicos
2 years agoFrequent Visitor
Remove rows in Power Query based on multiple logical criteria
Hi, I have a table with 3 columns: [ID]: Whole Number [Informations]: Text [Info quality]: Whole Number, from 1 to 4 I want to keep one row for each distinct [ID], but the row I keep mu...
- 2 years ago
rowstobedeleted= Table.Sort(Yoursource,{{Quality, Order.Ascending}})
and then you could use Table.Distinct to remove the duplicates. - 2 years ago
Hi,
This M code works
let Source = Excel.CurrentWorkbook(){[Name="Data"]}[Content], #"Changed Type" = Table.TransformColumnTypes(Source,{{"ID", Int64.Type}, {"Informations", type text}, {"Info Quality", Int64.Type}}), #"Grouped Rows" = Table.Group(#"Changed Type", {"ID"}, {{"Count", each Table.Min(_,"Info Quality")}}), #"Expanded Count" = Table.ExpandRecordColumn(#"Grouped Rows", "Count", {"Informations", "Info Quality"}, {"Informations", "Info Quality"}) in #"Expanded Count"Hope this helps.
HotChilli
2 years agoCommunity Champion
Correct. It can't be relied on.