You can use three queries ---
TRANSFORM Sum(meangene.CancValue) AS SumOfCancValue
SELECT meangene.CancReason
FROM meangene
GROUP BY meangene.CancReason
PIVOT meangene.Year;
TRANSFORM Sum(meangene.CancQty) AS SumOfCancQty
SELECT meangene.CancReason
FROM meangene
GROUP BY meangene.CancReason
PIVOT meangene.Year;
SELECT meangene_Crosstab_QTY.CancReason,
Sum(nz([meangene_Crosstab_QTY].[2007],0)) AS [2007 Cancel QTY],
Sum(nz([meangene_Crosstab_VAL].[2007],0)) AS [2007 Canceled Value],
Sum(nz([meangene_Crosstab_QTY].[2008],0)) AS [2008 Canceled QTY],
Sum(nz([meangene_Crosstab_VAL].[2008],0)) AS [2008 Canceled Value]
FROM meangene_Crosstab_QTY INNER JOIN meangene_Crosstab_VAL ON
meangene_Crosstab_QTY.CancReason = meangene_Crosstab_VAL.CancReason
GROUP BY meangene_Crosstab_QTY.CancReason;
--
KARL DEWEY
Build a little - Test a little
meangene said:
Karl - This did great for creating a crosstab with concatenated fields but I
didn't make my first post clear (sorry). I really needed separate fields in
repective columns on a report that that would allow me to grand total each
column at end of report(.i.e., =Sum([CancQty]) ). They need to see 4 columns
(07 qty, 07 value, 08 qty, 08 value) with sums at end. The table that has the
values is setup per my first post. I can do this with two subreports
sidebyside but curious if cleaner way. Thanks again!
:
You can have your cake and eat it too!
Substitute your table name for [meangene] ---
TRANSFORM Sum([CancQty]) & " " & Format(Sum([CancValue]),"Currency") AS Expr1
SELECT meangene.CancReason, Sum([CancQty]) & " " &
Format(Sum([CancValue]),"Currency") AS Totals
FROM meangene
GROUP BY meangene.CancReason
PIVOT [Year] & " Cancel QTY - Value";
--
KARL DEWEY
Build a little - Test a little
:
Have a table showing period-to-date order cancellation data as follows:
CancReason Year CancQty CancValue
WrongItem 2007 10 150.00
WrongItem 2008 8 130.00
WrongColor 2007 5 75.00
WrongColor 2008 7 98.00
Can't use single crosstab. How can I get a report to display as follows
without subreports?
CancReason 2007CancQty 2007CancValue 2008CancQty 2007CancValue
WrongItem 10 150.00 8
130.00
WrongColor 5 75.00 7
98.00
Thanks!!