Forum Discussion
pade
6 years agoAdvocate III
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...
- 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})
Nathaniel_C
6 years agoCommunity Champion
Hi pade ,
See if ImkeF has an answer. She is amazing with M.
If this solves your issues, please mark it as the solution, so that others can find it easily. Kudos are nice too.
Nathaniel