Forum Discussion
sandraemma
3 years agoFrequent Visitor
Sort columns based on string value
Hello, I am stuck on something for many days that I think should be fairly easy and any ideas can help! I have many different statuses (over 15 different, I only show few here) and I need to sor...
ronrsnfld
Super User
3 years ago- Group by ID
- Custom aggregation (need to use Advanced Filter) to return only the last item in the status column associated with that ID
- Remove any rows that have a completed status
let
Source = Table.FromColumns({
{1,1,1,1,2,2,3,3,3},
{"started","Processing","ready","completed","started","Processing","started","Processing","ready"}
},
type table[id=Int64.Type, status=text]
),
//Group by ID and return the "Last" item in the status column
#"Grouped Rows" = Table.Group(Source, {"id"}, {
{"status", each List.Last([status]), type text}}),
//Remove any rows where last status is "completed"
#"Filtered Rows" = Table.SelectRows(#"Grouped Rows", each ([status] <> "completed"))
in
#"Filtered Rows"