6 Replies Latest reply: Feb 7, 2014 4:10 AM by Frank Hartmann

# moving average

Hallo QV Community

I use the following formula in the chart for accounting the moving average:

Rangesum(above(Y,0,Row())/Row()

Is there any possibility to export the last value (=9) of the Rangesum formula to a textbox?

I tried to use the Rangesum formula within a textbox but it doesnt work for specific month.

The reason why i want to get this value to a textbox is because i need the value exported per macro to a powerpoint

document as picture or  as object.

any ideas?

• ###### Re: moving average

try to aggregate over y and take the max, something like :

Rangemax(aggr(rangesum(above(y,0,Rowno())), y))

• ###### Re: moving average

thank you for your tip. the following formula works for me

max(aggr(rangesum(above(y,0,Rowno()))/RowNo(), y))

But what if the actual value is not the max value? then the value will not be shown in the textbox.

any ideas?

• ###### Re: moving average

add firstsortedvalue function in the expression based on x axis instead of rangemax

• ###### Re: moving average

ok, now i have:

FirstSortedValue(aggr(rangesum(above(y,0,Rowno()))/RowNo(),y),x)

that gives me the firstvalue (=3), but i need the last value (=9)

what a pitty that there is no lastsortedvalue function in QV

any ideas?

• ###### Re: moving average

FirstSortedValue(aggr(rangesum(above(y,0,Rowno()))/RowNo(),y), -x)

• ###### Re: moving average

Thank u very much