Forum Discussion

pade's avatar
pade
Advocate III
6 years ago
Solved

Why does Table.AddIndexColumn create a decimal number (float) and not a whole number (int)

Anyone that knows why the Add Index Column command "Table.AddIndexColumn" generates numbers with the data type of float and not integer. Also, how can I cast to an integer value inline with the Table...
  • AnkitBI's avatar
    6 years ago

    Based on my understanding, answer to First question will be it as per design. As return type of Table.AddIndexColumn type is a 'Table', so Index column datatype is not in our control.

     

    Regarding Second question, as Table.AddIndexColumn retuns a table, so generic function is required to change the column data type in output table.

     

    = Table.TransformColumnTypes(Table.AddIndexColumn(#"Changed Type", "Index", 1, 1),{"Index",Int64.Type})