Forum Discussion
Adding Recuring Index
- 1 year ago
AFAIK, you can't do to directly get your desired output. But you could do something like:
= Table.AddIndexColumn(Source, "Index", 2/3,1/3) or = Table.AddIndexColumn(Source, "Index", 2/3,1/3, Int64.Type)and then, at the next step, change the data type to Int64.Type (whole number).
I would have thought is would do the conversion in the same step, but it does not.
Not sure exactly what you want.
To create the same sequence (List) of values you can use the List.Accumulate function
List.Accumulate(
{0..24},
{},
(s,c)=>s & {Number.IntegerDivide(c,3)+1})
If you want something else, please be more specific.
- Dicken1 year ago
Post Prodigy
Yes also used
= let alist = {0..Table.RowCount( Source)-1 } ,
index = List.Transform( alist, (x)=>
Number.IntegerDivide( x, 3 ) + 1 ) in index
and then Table from / to columns , to get result.
I was more interested in if there was a way to manipulate add index- ronrsnfld1 year ago
Super User
AFAIK, you can't do to directly get your desired output. But you could do something like:
= Table.AddIndexColumn(Source, "Index", 2/3,1/3) or = Table.AddIndexColumn(Source, "Index", 2/3,1/3, Int64.Type)and then, at the next step, change the data type to Int64.Type (whole number).
I would have thought is would do the conversion in the same step, but it does not.
- Dicken1 year ago
Post Prodigy
Thats pretty good, I can't remember what it was but had a different situation, where I had
to do a transformation and THEN apply the data type as here.
I'll mark this closed.