Server Connect Average Value IF

Sitting down to Wappler first thing with a cup of coffee. The mind is clear today. :wink:

So using the input that has been given so far this is what I’ve come up with:

And my output is:

image

So is this correct? Let’s verify with a little PowerShell:

Indeed! So these steps work perfectly. My only niggle: instead of having two set value steps, one to filter the collection down and then another to average it, I would like to do this in a single step and be able to construct it visually, not just by typing the expression.

Can anyone spot what is wrong with my syntax here? I am trying to divide the sum of one collection by the count of another. I am aware that there is an average function but in this case, it will not work in this particular step of the calculation because it needs to account for properties with 0 values, which do not exist in the lookback_gains collection. Therefore:

{{(lookback_gains.sum("change"))/(lookback_period_adj.count())}}

But I am getting this error: