8 Replies Latest reply: Jun 20, 2014 4:43 AM by Dennis Bijman

# Avg function not working as expected

Hi everyone,

I have some problems with my expression with the Avg funtion in it.

My formula is: Avg(Aggr([1],[2],[3],[4],[5],[6],[7],[8],[9],[10]))

And it shows an output value but it's not correctly.

I have also some statistic objects which calculates the average of a column and I think that's working fine but in my KPI it's not.

When using a calculator and calculate the average of the statistic object I have another output then my KPI is showing.

Please see the attachment to clear some things up.

The 3 KPI's have all 3 groups of columns(answers) you can see on the right side.

Please ask me if you need further info or another screenshot, thanks a lot!

• ###### Re: Avg function not working as expected

Is it a chart or text box you are writing this expression in? If chart, which chart? what are the dimensions?

• ###### Re: Avg function not working as expected

Hi

AGgr function is similar to SQL group by, so you have to a dimension that you r grouping by

thanks

• ###### Re: Avg function not working as expected

So I have to add a group in the dimension tab?

Like this:

• ###### Re: Avg function not working as expected

Thanks for the quick reply, I'm using this in the gauge chart and have no dimensions defined.

• ###### Re: Avg function not working as expected

Hi

is it possible to have sample qvw

regards

• ###### Re: Re: Avg function not working as expected

Sure, see attachment.

• ###### Re: Avg function not working as expected

Try Below,

RangeAvg(Avg([1]),Avg([2]),Avg([3]),Avg([4]),Avg([5]),Avg([6]),Avg([7]),Avg([8]),Avg([9]),Avg([10]))

Or

RangeAvg(Sum([1]),Sum([2]),Sum([3]),Sum([4]),Sum([5]),Sum([6]),Sum([7]),Sum([8]),Sum([9]),Sum([10]))

• ###### Re: Re: Avg function not working as expected

It works exactly like I wanted.

Thanks a lot!