xtab query 3 sets of values

cpberg1

It's always rainy here
Local time
Yesterday, 16:32
Joined
Jan 21, 2012
Messages
79
I can get this example from Allen Browne to apply to my database ok, however I'm stuck on getting 3 sets of values. In the example below I get qty and amt. In my example I'm trying to get qty, amt and budget.

I added budget to the tblxtabcolumns and I can get it to pull up as a column however the value is the same value as the amount column as without further work on the SQL it's assuming the fieldname is not equal to "QTY" it must be AMT. I assume that the TRANSFORM statement needs a nested IIF but I keep getting syntax errors. Any push in the proper direction?

From Allen Browne Xtab tutorial
http://allenbrowne.com/ser-67.html#MultipleValues



TRANSFORM Sum(IIf([FieldName]="Qty",[Quantity],[Quantity]*[Order Details]![UnitPrice])) AS TheValue
SELECT Products.ProductName
FROM tblXtabColumns, Products INNER JOIN (Orders INNER JOIN [Order Details]
ON Orders.OrderID = [Order Details].OrderID) ON Products.ProductID = [Order Details].ProductID
WHERE (Orders.OrderDate Between #1/1/1998# And #3/31/1998#)
GROUP BY Products.ProductName
PIVOT [FieldName] & Month([OrderDate]);
 

Users who are viewing this thread

Back
Top Bottom