Forum Discussion

bolabuga's avatar
bolabuga
Helper V
9 years ago
Solved

using [TableAction.DeleteRows]

Hello everyone, a little help in here.   i have a table.selectrows(#renamed columns2, each ([REFER] <> "1610"))   What i want to do is DELETE [REFER] = 1610, because its incomplete, and i will ne...
  • v-haibl-msft's avatar
    9 years ago

    bolabuga

     

    Table.SelectRows will only filter the table rows. To remove the specific rows, we can first add an conditional column to mark the rows which equal 1610. Then sort this mark column and delete the first N rows. At last we just need to delete the mark column.

     

     

        #"Added Conditional Column" = Table.AddColumn(#"Changed Type", "Custom", each if [REFER] = 1610 then "delete" else null ),
        #"Sorted Rows" = Table.Sort(#"Added Conditional Column",{{"Custom", Order.Descending}}),
        #"Removed Top Rows" = Table.Skip(#"Sorted Rows",2),
        #"Removed Columns" = Table.RemoveColumns(#"Removed Top Rows",{"Custom"})

     

    Best Regards,

    Herbert