Forum Discussion

Anonymous's avatar
Anonymous
Not applicable
6 years ago
Solved

How to dynamically delete Top Rows *Before a specific value in a Column1 in the below example.

How to dynamically delete Top Rows before a specific value(ex: ID Number) in Column1 in the below example : I have data set like below. Sometimes the Rownumber of "ID Number" changes. Havning diffic...
  • Anonymous's avatar
    Anonymous
    6 years ago

    Start by removing rows from the gui by putting in any number. Power query will write a line like below.

    #"Removed Top Rows" = Table.Skip(Source,2)

     

    Modify it to be the function each [Column1] <> "ID Number"

    #"Removed Top Rows" = Table.Skip(Source,each [Column1] <> "ID Number")

     

    Note that this code will work as long as all of the data in the column is text.

     

  • Jimmy801's avatar
    Jimmy801
    6 years ago

    Hello Anonymous 

     

    this code is created automatically by Power BI when you manully input data. I prefer to do this way to give everything the possibility to understand the solution. In future I will use the #table function to make it more clearly.

    If my post works as well, I would appreciate it you marking it as solution as well or to give a like.

     

    All the best

     

    Jimmy