9 Replies Latest reply: Jun 16, 2014 2:13 PM by Emmanuelle Bustos

# Avg() Function

Hello Guys,

I just want to clarify how Avg() works. The first time I use avg, it is working properly. Giving me the right average like 3.4 or 3.1 etc.

But I have to include a 'historical' data in my application and boom! The avg goes 'gaga' and my output average goes beyond 800+++!

Even if I click year 2013, my average computation is 700! Why did it went like that? How do I find/resolve this problem?

Can you guys give me how it works? Anyone can explain?

Thanks a bunch!

Donna

• ###### Re: Avg() Function

try this

avg({<year={"\$(=year)"}>}sales)

here sale is my fieldname.

you just put your fieldname there.

hope it helps

• ###### Re: Avg() Function

Sorry, still the same output :(

• ###### Re: Avg() Function

m not sure why it didn't give you right answer. might be there duplicate values use distinct word.

avg(distinct{<year={"\$(=year)"}>}sales).

• ###### Re: Avg() Function

The Avg() function works fine and returns the average per record. If you want the average per something else, e.g. Year you should use Sum(...) / Count(distinct Year)

You most likely have some records that have very large values. Find these by using the Max() function in a chart or in a statistics box.

HIC

• ###### Re: Avg() Function

What do you mean "beyond Logic"? What do you get as result?

Could it be that it just loses the formatting? It so, try TimeStamp(Sum()/Count(distinct )) .

HIC

• ###### Re: Avg() Function

Hi Henric

Thanks for response I meant an "unwanted result" sorry my expression I opened a discussion trying to be more specific: