Forum Discussion

Anonymous's avatar
Anonymous
Not applicable
3 years ago
Solved

Power Query: Issue with adding lists of numbers to tables

I would expect that the following statement adds a new column with lists of numbers: Table.AddColumn(#"Table", "Test", each {1, 2, 3}) Instead, the items in the lists are the numbers in text(!) for...
  • Vijay_A_Verma's avatar
    3 years ago

    Though it shows left aligned but type is number only. If you use following, you will find that TRUE is populated in the list

    = Table.AddColumn(#"Table", "Test", each List.Transform({1, 2, 3}, (x)=>x is number))

    if you use this, you will find FALSE

    = Table.AddColumn(#"Table", "Test", each List.Transform({1, 2, 3}, (x)=>x is text))

    Now, the type is set for the column not for list which you can do with below statement

    = Table.AddColumn(#"Table", "Test", each {1, 2, 3}, type {Int64.Type})

    When you expland this column, you will column type is set to Whole number. Otherwise column type will be set to Any.

    = Table.AddColumn(#"Table", "Test", each {1, 2, 3}, type {Int64.Type})