Forum Discussion

Mikee5's avatar
Mikee5
Regular Visitor
3 years ago
Solved

Delete Rows based on conditions

I am trying to clean rows containing Credit Notes as well as the rows with matching Invoices. For example I want to delete the row with CN-1234 as well as the row INV-1234.  It is easy to delete all ...
  • AlienSx's avatar
    3 years ago

    Hi, Mikee5 one more

    let
        Source = YourSource,
        cr_notes = List.Buffer(List.Select(Source[YourColumn], (x) => Text.Contains(x, "CN"))),
        lst = List.Buffer(List.Combine({List.Transform(CN, (x) => Text.Replace(x, "CN", "INV")), cr_notes})),
        select = Table.SelectRows(Source, (x) => not List.ContainsAny(x[YourColumn], lst))
    in 
        select