Forum Discussion
Getting the above value of the currently processed array (result array during formula execution)
- Feb 26, 2022
You comment on StackOverflow " I only get "From Table/Range" . But this one works with dynamic arrays as well. At least you may try if Power Query in attached file works in your environment.
Thanks a lot,
Both solutions work and are clear and fast enough for the data set I have. I liked the SCAN-LAMBDA solution.
For the sake of benefit could you please elaborate more on the use of the SCAN function; this is the first time I encounter it. I don't understand how 'first' gets updated during the steps. From the way I look at it, it should always put G1.
Regarding my comment, it seems I did not know how to do it. Thanks to your file and your clear PQ steps I understand how to do it.
SCAN has two parameters, initial value for the accumulator and an array which is scanned. Into the lambda function SCAN passes accumulator and value of the current array element. What is combined from them on each step is resulting in accumulator on that step and returned as an element of generated array.
Samples and definitions are here SCAN function (microsoft.com)
- aaboodiFeb 27, 2022Copper Contributorgot it, thank you