Need running percentage in pivot table

V

vbasean

I've a pivot table with results:

Washington Michigan
Apples, Oranges, Grapes Total| Apples, Oranges, Grapes Total|
234 345 23 602 198 275 5 478

I want to add a percentage of each fruit in each state

Washington Michigan
Apples, Oranges, Grapes Total| Apples, Oranges, Grapes Total|
234 345 23 602 198 275 5 478
39% 57% 4% 100% 41% 58% 1% 100%

thanks in advance.
 
V

vbasean

My weird solution:

First, my source table is made of unioned queries each consisting of a
'State's' worth of 'Fruits' (each 'State' is an actual column in the source
data so they have to be unioned into one column for the pivot to work as
'State' then 'Fruit')

I had to add a new column to the pivot source data

1/(SELECT COUNT([State]) FROM sourcetable) AS PercentageOfState

and then sum the field in the pivot and format it as a percentage.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top