Date Criteria - Last Month same day

G

Guest

I'm trying to run a query from the Sales Table that will give me a snapshot
of today's sales. I want to compare today's sales with sales from one month
ago, two months ago, three months ago etc. in the corresponding fields in the
same query.

How can I do this in Access query?

Please help.
 
G

Guest

Use calculated fields for each month you want to include:

ThisMo: IIf([SalesDate] = Date(),[SalesAmt],0)
LastMo: IIf([SalesDate] = DatAdd("m", -1, Date()), [SalesAmt],0)
2Mo: IIf([SalesDate] = DatAdd("m", -2, Date()), [SalesAmt],0)

And so on.
 
V

Van T. Dinh

.... but beware that this comparison is very rubbery ...

What if today's date were 31/03/2006?
 

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