Qlik Community

New to Qlik Sense

Discussion board where members can get started with Qlik Sense.

vanand3535
Contributor

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

Screenshot (504).png

6 Replies

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)

vanand3535
Contributor

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)

Screenshot (505).png

Screenshot (506).png

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?

Luminary
Luminary

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

zebhashmi
Valued Contributor

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)

vanand3535
Contributor

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)



Screenshot (521).png

Screenshot (522).png

Community Browser