Forum Discussion
Dicken
Post Prodigy
4 months agoList.Generate, make behave like Accumulate or XL REDUCE
Hi, my staring point was this, i wanted to accumute fieds to a record; so i used; let
f = {List.Sum, List.Max, List.Average},
head = {"sum", "max", "avg"},
pos = {0, 1, 2},
...
- 4 months ago
and try this
let f = {List.Sum,List.Max, List.Average}, head = { "sum", "max", "avg"}, val = {2,3,1,5,2,1}, to= List.Generate(()=> [ i = 0, j = Record.AddField( [],head {i}, f{i}(val) ) ], (x)=> x[i] <= List.Count( head)-1, (x)=> [i = x[i] + 1, j = Record.AddField( [],head {i},f{i}(val)) ], (x)=>x[j]) in Record.Combine( to)
lbendlin
Super User
4 months agoPlease provide sample data that covers your issue or question completely, in a usable format (not as a screenshot).
Do not include sensitive information. Do not include anything that is unrelated to the issue or question.
Please show the expected outcome based on the sample data you provided.
Need help uploading data? https://community.fabric.microsoft.com/t5/Community-Blog/How-to-provide-sample-data-in-the-Power-BI-Forum/ba-p/963216
Want faster answers? https://community.fabric.microsoft.com/t5/Desktop/How-to-Get-Your-Question-Answered-Quickly/m-p/1447523
- Dicken4 months ago
Post Prodigy
As far as i can tell there is no way to upload a copy of the file created, if there is could you plase let me know.