YTD Calculations

G

Guest

Are there any tricks to calculating YTD and Last Year Numbers

I have a Field [Total Sales] and a separate field [Order Date]

I can figure out how to calculate for this year only and for last year only
 
D

Dirk Goldgar

Stephen said:
Are there any tricks to calculating YTD and Last Year Numbers

I have a Field [Total Sales] and a separate field [Order Date]

I can figure out how to calculate for this year only and for last
year only

You don't give much information to go on, but you might try a query
along these lines to get total sales for this year:

SELECT Sum([Total Sales])
FROM YourTable
WHERE [Order Date] >= DateSerial(Year(Date()), 1, 1)
AND [Order Date] < DateSerial(Year(Date()) + 1, 1, 1);

And similarly for last year:

SELECT Sum([Total Sales])
FROM YourTable
WHERE [Order Date] >= DateSerial(Year(Date()) - 1, 1, 1)
AND [Order Date] < DateSerial(Year(Date()), 1, 1);
 

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