Forum Discussion

Chrisjr's avatar
Chrisjr
Helper IV
3 years ago
Solved

Changing columns types except selected ones

Hello All, 

 

I have the following table: 

BrandCategoryMarchAprilMay
ABDOP500750807
ACPDO200850890
ADOOB150970750
AADOP680160690

 

I am trying to create a function that would change the column types of all columns expceted the columns Brand and Category. 

(The other column's names will always change. The column "Brand" and "Category" will always be the 2 first columns and their names will never change)

 

I have tried the following function but doesn't work: 
        = Table.TransformColumnTypes(#"End stage 3",
List.Transform(
List.RemoveFirstN(
Table.ColumnNames(Source),
2
),
each {_, Int64.Type}
))

 

I get an error message : "Expression.Error: The column 'Item' of the table wasn't found.
Details:
Item"

 

but nowhere in my table or transformations I have a column names Item. 

 

Anyone has an idea how I could achieve this? 

  • = Table.TransformColumnTypes(#"End stage 3",
    List.Transform(
    List.RemoveFirstN(
    Table.ColumnNames(#"End stage 3"),
    2
    ),
    each {_, Int64.Type}
    ))

3 Replies

  • wdx223_Daniel's avatar
    wdx223_Daniel
    Community Champion

    = Table.TransformColumnTypes(#"End stage 3",
    List.Transform(
    List.RemoveFirstN(
    Table.ColumnNames(#"End stage 3"),
    2
    ),
    each {_, Int64.Type}
    ))

    • Chrisjr's avatar
      Chrisjr
      Helper IV

      I see you replaced the source with the previous step.