query to find avg of ordertotal from last year and this year

A

Ashley

I need to find out the avg amount of Ordertotal for last 1 year and
this year


if location is USA or Canada

This query gives me error for present year and how do I do this for
last year



avg((IIf((([Location]="USA") Or ([Location]="CANADA")) And ((
(datepart( 'y', ([OrderDate]))) = (datepart('y', date() ) )),
Ordertotal ,0))) AS [Average Order Amount This year],



Will this work for last year probably not


avg((IIf((([Location]="USA") Or ([Location]="CANADA")) And ((
(datepart( 'y', ([OrderDate]))) = (datepart('y', dateadd('y', -1,
date()) ) )), Ordertotal ,0))) AS [Average Order Amount This year],
 

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