Forum Discussion

DrBiDuro's avatar
DrBiDuro
Regular Visitor
10 years ago
Solved

Remove columns in advanced wuery editor

Hi all, i am pretty new to power BI and I am encontering a lot of little questions all the time.

 

For example, I have 2 data providers that come from URL (Web) to extract sales. The incomvenient is that the column structure of both tables will differ every time i refresh as it is possible that one of both has no sales data, causing different header names.

 

Long story short, I need to remove and / or select the columns regardless of their name with the same instruction for both queries. The advanced editor shows this command:

 

#"Removed Columns" = Table.RemoveColumns(Data0,"Column1"}). Here Column1 is removed.

 

Is it possible to index the columns and make it look sth like this?:

 

#"Removed Columns" = Table.RemoveColumns(Data0,1}),

 

Thanks a lot and best regards!!!

4 Replies

  • Anonymous's avatar
    Anonymous
    Not applicable

    I have the same problem too whit wuery :smileylol:

  • arify's avatar
    arify
    Icon for Microsoft Employee rankMicrosoft Employee

    Hi, you can do something like this:

    = Table.RemoveColumns(Data0, Table.ColumnNames(Data0, 0)})

    • DrBiDuro's avatar
      DrBiDuro
      Regular Visitor

      Herbert, thanks a lot, your solution fits perfectly!!!!

       

      SOLVED!!!