Forum Discussion

WanderingBI's avatar
WanderingBI
Icon for Resolver III rankResolver III
2 years ago
Solved

Is there a way to explicitly change a column type in Power Query?

Suppose I create a table:       let tableA = #table( {"Test"}, { {1 as number}, {"2" as text} } ) in tableA           Then I check the column type of...
  • AlienSx's avatar
    2 years ago

    to create table you want with #table 

     

    let
      tableA = #table(
        type table [Test = Int64.Type], 
        {
          {1 as number}, 
          {"2" as text}
        }
      )
    in
      tableA

     

    to change type of existing table 

     

    Value.ReplaceType(tableA, type table [Test = Int64.Type])

     

    background: read Ben Gribaudo's PQ M Primer, type system part.