Add numeric columns from text columns

  1. Add a numeric column from a source column stored as text.
  2. Use the Number.FromText() function within Table.AddColumn().
Figure 148: New Whole Number Column from Text Column
  • The type parameter to Table.AddColumn() is optional.
  • Leaving it blank results in a Any data type which would be loaded to the data model as a text data type.
  • By specifying Int64.Type (Figure 148), as the optional type parameter to Table.AddColumn(), the new column is a whole number:
    • Currency.Type sets the column as a Fixed Decimal Number
    • type number sets the new column as a Decimal Number
    • type text sets the column to a Text data type
    • type date sets the column to a Date data type
    • type time sets the column to a Time data type
  • Like all M expressions, data type declarations are case sensitive.