Skip to main content
Announcements
Have questions about Qlik Connect? Join us live on April 10th, at 11 AM ET: SIGN UP NOW
cancel
Showing results for 
Search instead for 
Did you mean: 
vanand3535
Creator III
Creator III

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
sunny_talwar

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
Creator III
Creator III
Author

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

sunny_talwar

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

pablolabbe
Luminary Alumni
Luminary Alumni

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
Specialist
Specialist

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

vanand3535
Creator III
Creator III
Author

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