Hi,
I am trying to create a list depending on 2 field values. In my table, I have a field BottomValue and a field TopValue. For each row I want to add a column with a List starting at BottomValue ending with TopValue, with a +1 increment. According to Microsoft the syntax is:
List.Generate(initial as function, condition as function, next as function, optional selector as nullable function) as list
I started with:
Table.AddColumn(#"Renamed Columns1", "TheList", each List.Generate(() =>10, each _ <= 90, each _ + 1))
Works as a charm.
replacing the 10 with my BottomValue field still works
Table.AddColumn(#"Renamed Columns1", "TheList", each List.Generate(() => [BottomValue], each _ <= 90, each _ + 1))
But replacing the top value with the field, gives an error
Table.AddColumn(#"Renamed Columns1", "TheList", each List.Generate(() => [BottomValue], each _ <= [TopValue], each _ + 1))
The error is:
Expression.Error: We cannot apply field access to the type Number.
Details:
Value=10
Key=TopValue
What am I doing wrong?
Thanks,
Carl
I am trying to create a list depending on 2 field values. In my table, I have a field BottomValue and a field TopValue. For each row I want to add a column with a List starting at BottomValue ending with TopValue, with a +1 increment. According to Microsoft the syntax is:
List.Generate(initial as function, condition as function, next as function, optional selector as nullable function) as list
I started with:
Table.AddColumn(#"Renamed Columns1", "TheList", each List.Generate(() =>10, each _ <= 90, each _ + 1))
Works as a charm.
replacing the 10 with my BottomValue field still works
Table.AddColumn(#"Renamed Columns1", "TheList", each List.Generate(() => [BottomValue], each _ <= 90, each _ + 1))
But replacing the top value with the field, gives an error
Table.AddColumn(#"Renamed Columns1", "TheList", each List.Generate(() => [BottomValue], each _ <= [TopValue], each _ + 1))
The error is:
Expression.Error: We cannot apply field access to the type Number.
Details:
Value=10
Key=TopValue
What am I doing wrong?
Thanks,
Carl