CrossTab - insert a calculated field

weiguo.shi

New member
Local time
Today, 14:10
Joined
May 4, 2011
Messages
9
Hello,

I met a problem in ACCESS 2010:
I have a PivotTable and I want to insert a field to calculate (for example) the difference between 2 values ​​in this table: eg
___________ 2007___2008___ Difference
Project 1_____200____218__________ 18
Project 2_____150____118_________ -32
Project 3____1520___ 1720________ 200
Is it possible?
Does anyone could give some advices?
Thank you in advance.

Weiguo
 
Last edited:
You may use the Cross-tab Query as source for a SELECT Query and create a new Column for calculation between transformed fields in the cross-tab query.
 
Create another query using that crosstab query as the source:

PHP:
SELECT ProjectNameField, [2007], [2008], ([2008]-[2007]) AS Difference
FROM CrossTabQueryName;

A couple problems with this might be-no field name called [2007] or [2008] and Access can sometimes puke when running a query that uses a crosstab query as a source. That depends on how much data is in the underlying table of the cross-tab query.
 
You may use the Cross-tab Query as source for a SELECT Query and create a new Column for calculation between transformed fields in the cross-tab query.

Thank you for your reply.

But the value I got is grouped by date, thus if I use this as a sub-query, I could not get the value '200' for example. And if I want to calculate the difference between every two weeks, what should I do? The query will update every week.

Thank you again.
 
Create another query using that crosstab query as the source:

PHP:
SELECT ProjectNameField, [2007], [2008], ([2008]-[2007]) AS Difference
FROM CrossTabQueryName;
A couple problems with this might be-no field name called [2007] or [2008] and Access can sometimes puke when running a query that uses a crosstab query as a source. That depends on how much data is in the underlying table of the cross-tab query.


Thank you for your reply.

But the value I got is grouped by date, thus if I use this as a sub-query, I could not get the value '200' for example. And if I want to calculate the difference between every two weeks, what should I do? The query will update every week.

Thank you again.
 

Users who are viewing this thread

Back
Top Bottom