A
AlexT
Folks
I have a table that lists sales by quarter and object type
stQtr ! stValue ! stObj !
----------------------------------
1 ! 100 ! gadget !
1 ! 50 ! widget !
2 ! 20 ! gadget !
2 ! 25 ! widget !
3 ! 5 ! widget !
I'd like to create a cross tab query that lists the *running* total of
sales per object type, ie
! Qtr1 ! Qtr2 ! Qtr3 !
-----------------------------------
gadgets ! 100 ! 120 ! 120 !
widgets ! 50 ! 75 ! 80 !
I have browsed through various material including this NG and I
understand that I have to calculate those running sum before running my
crosstab. However I'm not sure how to prepare that "base" query....
I have tried to create qSum as
SELECT Sales.stQtr, Sales.stObj, Sum(Sales.stValue) AS SumOfstValue
FROM Sales
GROUP BY Sales.stQtr, Sales.stObj;
And then
TRANSFORM Sum(qSum.SumOfstValue) AS SumOfSumOfstValue
SELECT qSum.stObj
FROM qSum
GROUP BY qSum.stObj
ORDER BY qSum.stQtr
PIVOT qSum.stQtr;
But that's not the trick...
Any help welcome
Regards
--alexT
I have a table that lists sales by quarter and object type
stQtr ! stValue ! stObj !
----------------------------------
1 ! 100 ! gadget !
1 ! 50 ! widget !
2 ! 20 ! gadget !
2 ! 25 ! widget !
3 ! 5 ! widget !
I'd like to create a cross tab query that lists the *running* total of
sales per object type, ie
! Qtr1 ! Qtr2 ! Qtr3 !
-----------------------------------
gadgets ! 100 ! 120 ! 120 !
widgets ! 50 ! 75 ! 80 !
I have browsed through various material including this NG and I
understand that I have to calculate those running sum before running my
crosstab. However I'm not sure how to prepare that "base" query....
I have tried to create qSum as
SELECT Sales.stQtr, Sales.stObj, Sum(Sales.stValue) AS SumOfstValue
FROM Sales
GROUP BY Sales.stQtr, Sales.stObj;
And then
TRANSFORM Sum(qSum.SumOfstValue) AS SumOfSumOfstValue
SELECT qSum.stObj
FROM qSum
GROUP BY qSum.stObj
ORDER BY qSum.stQtr
PIVOT qSum.stQtr;
But that's not the trick...
Any help welcome
Regards
--alexT