Transform Column Type For All Columns Except The First 2 Colummns RRS feed

  • Question

  • Hello,

    As a simplified example of my issue, let's assume 2 scenarios.

    Scenario 1: I have a table with 5 columns.

    When I load the data into PowerQuery, it transforms the data using:

    #"Changed Type = "Table.TransformColumnTypes(Source,{{"Customer", type text}, {"Key Figure", type text}, {"01.2015", Int64.Type}, {"02.2015", Int64.Type}, {"03.2015", Int64.Type}}

    Scenario 2: I have extra columns, and with different headers.

    The query fails because it can't find the same headers.

    I would need help to dynamically transform ColumnTypes to Int64.Type for ALL COLUMNS apart from the first 2 columns, regardless of their name.

    Saturday, September 3, 2016 6:42 AM


  • ColumnsType = Table.TransformColumnTypes(Source,List.Transform(List.Skip(Table.ColumnNames(Source),2), each {_, Int64.Type}))

    Saturday, September 3, 2016 8:57 AM

All replies