
1. Re: How do I calculate the weighted average on a group of data in tableau?
Ramon Martinez Dec 30, 2013 9:45 AM (in response to Tiffany Batton)Hello Tiffany,
It is not easy for us as helpers to provide you a solution if we don't have more information about your scenario.
Please provide a workbook with sample data to see if we are able to figure out a solution for you.
Best,
Ramon

2. Re: How do I calculate the weighted average on a group of data in tableau?
Tiffany Batton Dec 30, 2013 9:48 AM (in response to Ramon Martinez)Hi Ramon,
My apologies. I thought I attached the workbook in my original post. It is there now. Thanks for your help!

3. Re: How do I calculate the weighted average on a group of data in tableau?
Tiffany Batton Dec 30, 2013 9:53 AM (in response to Ramon Martinez)· Hi Ramon,
My apologies. I thought I attached the workbook in my original post. It is there now. Thanks for your help!
Tiffany Batton
Metrics and Analytical Consultant
Northwestern Mutual  Enterprise Solutions

Book2.twbx 219.5 KB


4. Re: Re: How do I calculate the weighted average on a group of data in tableau?
Ramon Martinez Dec 30, 2013 10:30 AM (in response to Tiffany Batton)Hi Tiffany,
I did some minor changes to see if I'm understanding well your requirements.
Your original formula for Weighted Average is calculating the Total Weighted Average. See the Grand Total at Sheet 2.
I created an additional calculated field called Weighted Average new with the formula:
SUM([Average TOW Completion Age]*[Number of Cases])/TOTAL(SUM([Number of Cases]))
computed using Table (Down), this means that its value are calculated respect the Grand Total of Number of cases. See that the Grand Total of Weighted Average new is similar to Weighted Average , but with my formula it is possible to calculate the Weighted Average per row of the table.
Changing Compute using Pane, for instance, allows to calculate the weighted average of every row in the table respect to the subtotal of every pane defined by the dimension TOW (Type of Work)
take a look and let me know if this shed some light to reach your solution.
Best
Ramon

Book2_RM.twbx 225.0 KB


5. Re: How do I calculate the weighted average on a group of data in tableau?
Peter Gilks Dec 30, 2013 10:35 AM (in response to Tiffany Batton)Hi Tiffany, I'm not sure exactly what the results should look like or what you are trying to achieve like but try the following:
Change your calculation to
AVG([Average TOW Completion Age])*(sum([Number of Cases]))/TOTAL(SUM([Number of Cases]))
set the calculation direction to Table(down)
Then add a column grand total. That Grand Total should now be the overall weighted average.
If you want to calculate weighted averages by subtotal at SOW level then using Compute Using > Pane (Down)

6. Re: How do I calculate the weighted average on a group of data in tableau?
Peter Gilks Dec 30, 2013 10:35 AM (in response to Ramon Martinez)Doh! I was doing this at exactly the same time as you Ramon

7. Re: How do I calculate the weighted average on a group of data in tableau?
Tiffany Batton Dec 30, 2013 10:43 AM (in response to Ramon Martinez)Hi Ramon,
this is very helpful. I have another question. How would I show the weighted average per type of work (tow) or in a bucket?

8. Re: How do I calculate the weighted average on a group of data in tableau?
Tiffany Batton Dec 30, 2013 10:43 AM (in response to Peter Gilks)Thanks Peter!

9. Re: How do I calculate the weighted average on a group of data in tableau?
Ramon Martinez Dec 30, 2013 10:43 AM (in response to Peter Gilks)Hi Peter,
I'm here just having fun, studying and practicing for my Certification Exam with real problems provided by members of the community. Good to see your contributions to the community.
I liked your Workbook Library post today.
Warm regards
Ramon

10. Re: How do I calculate the weighted average on a group of data in tableau?
Ramon Martinez Dec 30, 2013 10:48 AM (in response to Tiffany Batton)You have tow options here:
1. Adding Subtotals to Sheet 2, by going to menu Analysis>Totals>Add Subtotals , or
2. Remove the dimension TOW Detail from Rows shelf
Let me know if that works for you
Best
Ramon

11. Re: How do I calculate the weighted average on a group of data in tableau?
Peter Gilks Dec 30, 2013 10:55 AM (in response to Ramon Martinez)I'm wondering if none of this is needed, just using average at the right level should do exactly the same thing.
i.e. average your average!

12. Re: How do I calculate the weighted average on a group of data in tableau?
Peter Gilks Dec 30, 2013 10:57 AM (in response to Peter Gilks)this is definitely the case, use AVG(Average TOW Completion Age) and that will give you weighted Average TOW Completion Age. Then just put in dimensions as you see fit to break into smaller groups.

13. Re: How do I calculate the weighted average on a group of data in tableau?
Peter Gilks Dec 30, 2013 11:03 AM (in response to Ramon Martinez)Thanks Ramon, getting in early on my resolution for 2014 to get make more effort on the forums

14. Re: How do I calculate the weighted average on a group of data in tableau?
Ramon Martinez Dec 30, 2013 11:14 AM (in response to Peter Gilks)You are right Peter. I'm not understanding well the meaning of Average TOW Completion Age as weight.
Maybe Tiffany are able to provide more information.