Forum Discussion
Dicken
28 days agoPost Prodigy
Accumulated average
I want to accumulte the but as ans average, so : { 1, 1, 1 ,1} = 1 / 1 , 2 /2 , 3/3 , 4/ 4 so here the average is calculated in select; let
alist =
let
alist = List.Number...
- 27 days ago
I want the cuumulative average, the example i gave shows a correct result.
Dicken
27 days agoPost Prodigy
o as is said, but done within the fuunction, not select part of generate so;
ronrsnfld
27 days agoSuper User
Still not sure exactly what you want.
If you want a standalone function that will do the computation, then try:
(alist as list)=>
List.Generate(
()=>[a=alist{0}, idx=0],
each [idx] < List.Count(alist),
each [idx=[idx]+1, a = List.Sum(List.Range(alist,0, idx+1))/(idx+1)],
each [a])
You could use like:
let
alist = List.Numbers(1,12,1),
avg = fnRunningAvg(alist),
tbl = Table.FromColumns({alist, avg}, type table[Numbers=Int64.Type, Running Avg = number])
in
tbl
- Dicken26 days agoPost Prodigy
Good idea, but it can be somplfied so no need for a record and use avverage instead of sum,
i have posted as a solution, I'm nto sure how effecient range is .