Sign InHelp

Turn on suggestions

Auto-suggest helps you quickly narrow down your search results by suggesting possible matches as you type.

Showing results for

Auto-suggest helps you quickly narrow down your search results by suggesting possible matches as you type.

Showing results for

Documents for QlikView related information.

Announcements

QlikView Fans! We’d love to hear from you.

Share your QlikView feedback with the product team…__Click here__ to participate in our 5-minute survey.

Rules, plus terms and conditions, can be__found here.__

Share your QlikView feedback with the product team…

Rules, plus terms and conditions, can be

- Qlik Community
- :
- Qlik Product Forums
- :
- QlikView
- :
- QlikView Documents
- :
- What’s a Weighted Average and how do you calculate...

Options

- Article History
- Subscribe to RSS Feed
- Mark as New
- Mark as Read
- Bookmark
- Subscribe
- Email to a Friend
- Printer Friendly Page
- Report Inappropriate Content

hja

Contributor

02-24-2014
06:57 PM

- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content

What’s a Weighted Average and how do you calculate it in QlikView?

Citing Investopedia, the definition of a ‘Weighted Average’ is “An average in which each quantity to be averaged is assigned a weight. These weightings determine the relative importance of each quantity on the average. Weightings are the equivalent of having that many like items with the same value involved in the average.”

Weighted Average. In *Formula, Financial Theory*. Retrieved February 12^{th}, 2014, from http://www.investopedia.com/terms/w/weightedaverage.asp.

I created the below example in Excel to describe the concept:

Assume you have the following data where you have 5 people, 3 of them are 25 years old and 2 are 28 years old. You then have weightings assigned to the various values:

Step 1 - You would the multiple each value by its weight. To do this in the example, first multiply each value (Age) by it’s weight (Age * Weight):

Step 2 – Get the total value of all the numbers calculated in Step1.

Step 3 – Add up the total weighting values

Step 4 – Divide the total value of Step 2 by the total weight of Step 3:

This number now represents the weighted average.

To perform this same operation in QlikView, you would create a Chart – a Straight Table.

The Dimension would be on the Age

You would then create 2 Expressions – 1 Expression to calculate the Weighted Total over Age and a final Expression that would calculate the Weighted Average. You would use the AGGR() function to perform this task – this function will return a valule of an expression calculated over a dimension (ie. Get me the total value of Weight calculated over the Dimension Age)

To create the total for the Weight, you would use the following syntax:

**Weighted Total**

Sum(Aggr(Sum(Total Weight), Age))

To create the **Weighted Average**, you would use the following calculation:

Sum(Total Age * Aggr(Sum(Weight), Age)) / Sum(Total Aggr(Sum(Weight), Age))

Comments

vireshkolagimat

Contributor II

10-28-2016
05:30 AM

- Mark as Read
- Mark as New
- Bookmark
- Permalink
- Email to a Friend
- Report Inappropriate Content

Why you have used the Total key word while calculating the sum of Weight.

In which case we use Total key word and also what is the difference between sum(Weight) and sum(Total Weight).

thank you.

hja

Contributor

10-28-2016
11:08 AM

- Mark as Read
- Mark as New
- Bookmark
- Permalink
- Email to a Friend
- Report Inappropriate Content

If the word TOTAL occurs before the function arguments, the calculation is made over all possible values given the current selections, and not just those that pertain to the current dimensional value, that is, it disregards the chart dimensions. |

Sum - chart function ‒ QlikView

vlastimilkosik

New Contributor III

04-07-2017
05:51 AM

- Mark as Read
- Mark as New
- Bookmark
- Permalink
- Email to a Friend
- Report Inappropriate Content

Hi There,

Are you sure you got this right? I mean the in STEP3. I would say you are supposed to divide it by the actual number of occurrences (number of rows) and not by the weight. You have already took the weight into consideration already by calculating new values. Those new values should be simply averaged now.

Version history