6 Replies Latest reply: Feb 28, 2018 11:50 AM by Vivek Anand

# how to find average sales of last three years(2010,2011,2012)

i tried .....

sum({<Year={2010,2011,2012}>}Sales)

/

Count({<Year={2010,2011,2012}>}Sales)

is there any other way to find averag

• ###### Re: how to find average sales of last three years(2010,2011,2012)

I think average can be very tricky and you might want to look here for why....

Average – Which average?

You can do this

Avg({<Year={2010,2011,2012}>}Sales)

Or this

Sum({<Year={2010,2011,2012}>}Sales)

/

Count(DISTINCT {<Year={2010,2011,2012}>} Trans_ID)

• ###### Re: how to find average sales of last three years(2010,2011,2012)

Hi,

I am getting different answer by both ways:-

but naswer should be the same

;-

NOte:- Dimension------Year(2009,2010,2011,2012)

Measure:--------Sales(Sum)

• ###### Re: how to find average sales of last three years(2010,2011,2012)

Like I mentioned.... Average can be tricky... do you or your users agree with one of the two ways the average is getting calculated?

• ###### Re: how to find average sales of last three years(2010,2011,2012)

When applicable please mark the appropriate replies as CORRECT. This will help community members and Qlik Employees know which discussions have already been addressed and have a possible known solution. Please mark threads as HELPFUL if the provided solution is helpful to the problem, but does not necessarily solve the indicated problem. You can mark multiple threads as HELPFUL if you feel additional info is useful to others

• ###### Re: how to find average sales of last three years(2010,2011,2012)

Sum({<Year={2010,2011,2012}>}Sales)/Count(DISTINCT{<Year={2010,2011,2012}>}Year)

• ###### Re: how to find average sales of last three years(2010,2011,2012)

Today I tried to formula ,I got same output for both for finding average of last three years(2010,2011,2012)

In my graph ,

Dimension- year(2010,2011,2012)

Measure  ----Sum(Sales)

Here I have attached two  screen shots ..in which by both ways I got same output for the average sales of last three years

Expressions:-

Avg({<Year={2010,2011,2012}>}Sales)

or

Sum({<Year={2010,2011,2012}>}Sales) / Count( {<Year={2010,2011,2012}>} Sales)