Power Query List.Accumulate – Unleashed
Following a reader’s request, today we will unleash the power of List.Accumulate.
The official documentation on List.Accumulate here was very confusing for me:
List.Accumulate(list as list, seed as any, accumulator as function)as any
Argument | Description |
---|---|
list | The List to check. |
seed | The initial value seed. |
accumulator | The value accumulator function. |
OK. I understood the list argument quite right, but the other two arguments were post-nuclear-bomb science fiction.
So let’s try to understand the example that was used in the official page:
// This accumulates the sum of the numbers in the list provided. List.Accumulate({1, 2, 3, 4, 5}, 0, (state, current) => state + current) equals 15
Oh, so the code above sums up all the elements in the list. That is nice. Let’s make sure the calculation was done right. 1+2+3+4+5 = 15. Yes, this is right 🙂
To prove that the code works, we can paste it to the Query Editor after creating a blank query:
View original post 918 more words
Categories: BI
Comments (0)
Trackbacks (0)
Leave a comment
Trackback