Query to show dates from last 10 weeks

4l3x_26

New member
Local time
Today, 10:58
Joined
Sep 15, 2016
Messages
1
Hi guys,

i am new here, but i was hoping you could help me. I have a Database dating back to 2014, it contains a calendar week field and a time stamp which is basically the just the Date the sale has been made.

My problem now is, I have to make a query which contains Data from the last 10 weeks. so for example, i refresh in CW 24 would mean i need data from CW14 to CW 23. And a little added problem, i need this to be dynamic so if refreshed in CW 25 data should be from CW 15 to CW 24, and so on and so forth.

I tried to do this on my own but it didn't go anywhere.

Here is my try:

Between Year([Timestamp])* 53 + DatePart("ww"; [Timestamp]) = Year(Date())* 53 + DatePart("ww"; Datum())-10 and Year([Timestamp])* 53 + DatePart("ww"; [Timestamp]) = Year(Datum())* 53 + DatePart("ww"; Date())-1

The Syntax was ok, but it just doesn't display any Values.

So i was really hoping someone could help me.

I hope i was clear enough so one can understand what i mean. Thanks in advance, any help is appreciated.

BR
 
???Please try to tell us in simple, plain English what the database is about --just as you would tell an 8 year old.

Readers have no knowledge of you or your environment, so tell us about CW; and the tables you have.
 
If it's always the last 10 weeks the you can use DateAdd function

Between Date() and DateAdd("ww",-10,Date())

Would give you 10 weeks back from today.
 

Users who are viewing this thread

Back
Top Bottom