Don't miss your chance to take the Fabric Data Engineer (DP-600) exam for FREE! Find out how by attending the DP-600 session on April 23rd (pacific time), live or on-demand.
Learn moreJoin the FabCon + SQLCon recap series. Up next: Power BI, Real-Time Intelligence, IQ and AI, and Data Factory take center stage. All sessions are available on-demand after the live show. Register now
Hi Experts,
I am having an issue with the below code, It lays around the : result = List.Generate(
() => [runningTotal, additionalValuesList, 0], I get a error message stating that i need a token']' but can not find a issue here.
Any help as always would be greatly appreciated
Kind Regards
RunningTotal AdditionalValues
| 4 | 0 |
| -6 | 0 |
| -16 | 4 |
| -19 | 10 |
| -21 | 6 |
| -35 | 3 |
let
Source = Excel.CurrentWorkbook(){[Name="Table1"]}[Content],
AddValues = Table.AddColumn(Source, "AdjustedRunningTotal", each
let
runningTotal = [RunningTotal],
additionalValuesList = List.Buffer(Table.Column(Source, "AdditionalValues")),
result = List.Generate(
() => [runningTotal, additionalValuesList, 0],
each List.First(_) < 0,
each [
List.First(_) + List.First(List.Middle(_)),
List.RemoveFirstN(List.Middle(_), 1),
List.Last(List.Middle(_)) + List.First(List.Middle(_))
]
)
in
List.First(result)
)
in
AddValues
Solved! Go to Solution.
Hi, @Anonymous [runningTotal, additionalValuesList, 0] is record, record has fields, fields have names. Your record does not have field names.
Next, each List.First(_) < 0 evaluates each item in the list that List.Generate generates. But wait, the very first item is record, not list.
And finally, even if you fix all bugs in your code then List.First(result) is going to give you ... the very first item which is your record defined in the very first line of List.Generate.
You'd better explain here how would you like the column AdjustedRunningTotal to be calculated.
Hi, @Anonymous [runningTotal, additionalValuesList, 0] is record, record has fields, fields have names. Your record does not have field names.
Next, each List.First(_) < 0 evaluates each item in the list that List.Generate generates. But wait, the very first item is record, not list.
And finally, even if you fix all bugs in your code then List.First(result) is going to give you ... the very first item which is your record defined in the very first line of List.Generate.
You'd better explain here how would you like the column AdjustedRunningTotal to be calculated.
Check out the April 2026 Power BI update to learn about new features.
If you have recently started exploring Fabric, we'd love to hear how it's going. Your feedback can help with product improvements.
A new Power BI DataViz World Championship is coming this June! Don't miss out on submitting your entry.
| User | Count |
|---|---|
| 5 | |
| 3 | |
| 3 | |
| 3 | |
| 3 |
| User | Count |
|---|---|
| 8 | |
| 6 | |
| 5 | |
| 5 | |
| 4 |