Weighted Averages in Tableau

by Zachary Ryan

As part of our Stats 101 class today, we learnt about some ways Tableau calculates some important descriptive statistics. One of these was a Weighted Average.

For the uninitiated, weighted averages are a way to calculate an average, when some points may contribute more than others. An example of this would be university final year scores, where, for example, coursework may make up 20% of your final grade for the year, with assignments making up another 30% and final exams making up the last 50%. A score of 80/100 for coursework may seem like a higher number than if you were to get a 50/80 for your final exams, however due to the different weighting of those scores, don't expect to see your final score closer to the 80, but rather to the 50 (never get your hopes up with weightings, learnt that the hard way).

To take these different weightings into account, we learnt about a formula today which would help make it much easier to understand and consequently, easier to compute in Tableau. To do this, we want to get the actual score, divided by the maximum score, before then multiplying that figure by the percentage in decimal form. In the case of our coursework grade example, we'd be dividing 80 by 100, giving us 0.8, before then multiplying 0.8 by 0.2, giving us 0.16. We'd then follow this same formula for the next couple marks for both assignments and final exams, before then adding those numbers together to get the final mark for the year.

Now, for the likes of Tableau, its a lot simpler since its a single calculation, compared to repeating it three times like in the example I hopefully explained well enough above.

With this calculation, we're taking into account the quantity of the products sold on everyone's favourite dataset, Superstore. With this, we've now got the weighted average of the profit received by the store and can look at in relation to the likes of region, and see how those different quantities can affect the overall average profit of the company.

We can see that with the weighting of differing quantities taken into account, the overall average profit for each region increases quite noticeably. It's an interesting angle to analysis to take and I can see myself using this for potential projects in the future where weighting would be an interesting factor to look into!