Pivot Table Query add Formula columns

Pivot Table Query add Formula columns

Post by ardi » Thu, 18 Dec 2008 04:01:29



Hello,

I have created my pivot table with this MS Access query ,
transform max(value)
select hour from mytable group by label
pivot label

below is the Table output from pivot table query :

Hour A B C
1 15 14 21
2 22 23 24
3 21 33 11
4 10 10 10

I would like to added one columns with this simple formula (A+B +C )/
3
so the output like this.

Hour A B C Avg
1 15 14 21 16.67
2 22 23 24 23
3 21 33 11 ....
4 10 10 10


based on that formula .. Is there
a way to do that?. Please let me know.

Thanks in advance
 
 
 

Pivot Table Query add Formula columns

Post by John Spenc » Thu, 18 Dec 2008 05:02:04

Simpler might be

TRANSFORM Max(Value) as TheMax
SELECT Hour, Avg(Value) as TheAverage
FROM MyTable
GROUP BY HOUR
PIVOT Label

By the way, posting the actual query string makes life a lot easier. Your
posted "sample" contained an error that would generate a syntax error.

John Spencer
Access MVP 2002-2005, 2007-2008
The Hilltop Institute
University of Maryland Baltimore County