Thursday, March 7, 2013

[TABLEAU] Calculating Weighted Averages




Calculating Weighted Averages

Averages are used to summarize data results. However, the type of average chosen to represent the results can affect the overall conclusions drawn from the data. This article covers how to calculate weighted averages and uses an example that compares the results from using a weighted average versus an unweighted average to summarize the data.


Raw Data

The data in this example includes survey results for two different survey tests summarized by the four groups who took each test, their respective sample sizes, and their frequency of affirmative answers:




Calculating the Weighted Average

The weighted average of the results are calculated by factoring in the sample size with the rate of affirmative answers to create a more even comparison between the two test results. The general formula for calculating a weighted average is as follows:

sum (weight * value) / sum (weight)

In Tableau, the formula is applied through a calculated field. To create a calculated field, right-click the Measures area of the Data window and select Create Calculated Field. For this example, the weight parameter from the general weighted average formula is the Sample Size measure, and the value parameter is the Frequency measure.






Comparing the Results

The view below shows the comparison between using the weighted average and the unweighted average to summarize the results. In this example, it is noted that the unweighted average shows that Test 2 has the highest frequency of affirmative responses, but the weighted average shows that Test 1 has the highest frequency of affirmative responses.









1 comment: