Power BI
Needs VotesAdd column - Index column, i.e. Table.AddIndexColumn, shall create whole numbers (int) instead of decimal numbers (float)
Pär Adeen on 16 Sep 2019 14:37:38
Currently the Table.AddIndexColumn () functions creates values of type decimal (floats). I see no reason for creating decimal numbers since the incremental steps can't be set to decimal number, nor the initial value can be set to a decimal value:
Table.AddIndexColumn(table as table, newColumnName as text, optional initialValue as nullable number, optional increment as nullable number) as table
The documentation does not say what type the new column will have, but now it's created as decimal number.
The recommendation will be that Microsoft either changes the type of the generated column, or extends the parameter set with a type so we can define the type as integers (int64) instead
As there can't be anu reason for the index column to have float values, this is likely to be considered as an bug
- Comments (4)
RE: Add column - Index column, i.e. Table.AddIndexColumn, shall create whole numbers (int) instead of decimal numbers (float)
As this is now implemented you can mark this with Implemented ;-)
Thanks a lot for helping out
RE: Add column - Index column, i.e. Table.AddIndexColumn, shall create whole numbers (int) instead of decimal numbers (float)
I can see that Power BI Ideas Admin has positive comments on this, although I can't see any actions. Maybe this ha been forgotten
RE: Add column - Index column, i.e. Table.AddIndexColumn, shall create whole numbers (int) instead of decimal numbers (float)
This should absolutely be an integer number, we are unable to generate specifically needed indexes with float.
RE: Add column - Index column, i.e. Table.AddIndexColumn, shall create whole numbers (int) instead of decimal numbers (float)
I feel that Table.AddIndexColumn, by default, should use the smallest integer type that it needs to creates all of the indexes. For example, if your table has only 100 rows, then Int8.Type would be used and not Int64.Type.