Working with Pivot tables today. The data is simple:
Category
Hours
So we might have:
We want a pivot table with rows being the Category and two columns Hrs and % of total Hrs. We get
OK, that's all easy - no problems. Now here's the zinger. We want a "goal". Say our work must be 70% (our goal) and Vacation 30%. So what I want is a Pivot table that looks like:
So how to pull this off? I tried a calculated field with something like VLOOKUP but I can't seem to make that work. So then I thought maybe I could put the Goal number in the dataset. Something like:
We can't just SUM because we would get:
Brilliant me I decided to do MAX rather than SUM and bingo:
But the downside is that summary figures are calculated using MAX and that's no good. A more complex example shows this. Here's the Pivot table with more data
so what happens is the MAX function is applied to the sub-totals and the grand total. That's no good.
So anyone got any good ideas on how to do this? I'm fine with calculated fields, fine with data in the dataset but I getta get the sub-totals and totals right.
Thanks.
Category
Hours
So we might have:
Code:
Category Hrs
Work 8
Work 8
Vacation 8
We want a pivot table with rows being the Category and two columns Hrs and % of total Hrs. We get
Code:
Category Sum Hrs %
Work 16 66
Vacation 8 33
OK, that's all easy - no problems. Now here's the zinger. We want a "goal". Say our work must be 70% (our goal) and Vacation 30%. So what I want is a Pivot table that looks like:
Code:
Category Sum Hrs % Goal
Work 16 66 70
Vacation 8 33 30
So how to pull this off? I tried a calculated field with something like VLOOKUP but I can't seem to make that work. So then I thought maybe I could put the Goal number in the dataset. Something like:
Code:
Category Hrs Goal
Work 8 70
Work 8 70
Vacation 8 30
We can't just SUM because we would get:
Code:
Category Sum Hrs % Goal
Work 16 66 140
Vacation 8 33 30
Brilliant me I decided to do MAX rather than SUM and bingo:
Code:
Category Sum Hrs % Goal
Work 16 66 70
Vacation 8 33 30
But the downside is that summary figures are calculated using MAX and that's no good. A more complex example shows this. Here's the Pivot table with more data
Code:
Category Sum Hrs % Goal Correct Goal Is
Customer Facing 24 60 60 70
Work 16 40 60 60
QA testing 8 20 10 10
Mon-Customer Facing 16 40 20 30
Vacation 8 20 20 20
Sick Time 8 20 10 10
Grand total 40 100 60 100
so what happens is the MAX function is applied to the sub-totals and the grand total. That's no good.
So anyone got any good ideas on how to do this? I'm fine with calculated fields, fine with data in the dataset but I getta get the sub-totals and totals right.
Thanks.