Forum Discussion
How to weight counts in pivot tables
Hi all!
I'm so excited to join this community. I was hoping to find some help about an issue I haven't been able to figure out on my own. I have attached a screenshot of a simplified version of the issue for reference.
I need the weighted counts of each category (the Count*AVERAGE(WEIGHT) Column) to appear in the pivot table by themselves. So in this case, 7.45 for Apple and 2.6 for Banana. I need to be able to do this for as many variables as possible, and I need it to work with filters. For instance, if I chose to filter to show only people who selected Blue, it would show .85 Banana and (1.15+1.25+0.9+1.05) Apple. This calculation can be done by multiplying the count by the average of the weights, I hope that the filtering function behind pivot tables can also keep the weights assigned to each column to average them out.
I know that I will need to do a calculated field multiplying the pivot table count column by the average of the weight column. I would like to be able to do this automatically for all columns, so any new column I add (say "favorite animal") would show up as weighted if I moved its data into the pivot table.
Thank you so much!
7 Replies
- Toni_RoschtschaCopper Contributor
Hi Matt
I am trying to do the same thing you are, did you ever find a way of accomplishing using a weighted average with a count function?
Thanks!
Toni
- DrDiablarieCopper Contributor
@Matt_Vaughn Toni_Roschtscha
did either of you ever find a solution? I'm trying to figure out the same thing
- Riny_van_EekelenPlatinum Contributor
Since you managed to count the number of Fruit, I'm confident that you can also drag the Weight field into the value area of the pivot table and change its attribute to "Average" rather than "Sum".
- Matt_VaughnCopper Contributor
Yes, but how do I multiply the average by the count within the pivot table and only show the end value?
- Riny_van_EekelenPlatinum Contributor
I don't follow. Count X Average Weight would be the same as SUM of Weight. You can test it by adding another value field, like:
By the way, I deleted my example that I used in my first response. Therefore you see Name and Value in stead of Fruit and Weight.