TRANSFORM and Avg()

G

Gwen H

How do I tell the following SQL from a crosstab query to average the
crossSell.newCustomers field **ONLY** if that field contains a value greater
than zero (0)? I have tried enclosing the Avg function following TRANSFORM in
an Iif statement, but I get an error message.

TRANSFORM Avg(crossSell.newCustomers) AS AvgOfnewCustomers
SELECT crossSell.Branch, Avg(crossSell.newCustomers) AS [Total newCustomers]
FROM crossSell
GROUP BY crossSell.Branch
PIVOT crossSell.[B#];

I'm trying to accomplish something like this:

TRANSFORM Iif([crossSell.newCustomers] > 0, avg(crossSell.newCustomers),
sum(crossSell.newCustomers))

Thanks in advance for your help!
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top