Skip to main content
Announcements
See what Drew Clarke has to say about the Qlik Talend Cloud launch! READ THE BLOG
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

Function Addweeks() ???

Hi,

I need to get the corresponding day 52 weeks ago, so if I have a Tuesday I need to get the corresponding Tuesday 52 weeks ago ...

Since there is no method addweeks(DATE, -52), how is the best way to solve this issue?

Best regards
& thanks in advance

Stefan WALTHER

4 Replies
Not applicable
Author

Hi Stefan,

Try this :

Date(YourDate - (52*7)) as SameDayLastYear

Anonymous
Not applicable
Author

Obviously there is no need for AddWeek function because a week is always exactly 7 days...

Not applicable
Author

you can also add Day# in Year to your master calendar, obviously this will vary on leap years but works great.  I also add Business Day# in Year and you can even exclude business holidays

DeanoC
Contributor
Contributor

Hi There.

The solution is to employ the 'AddMonths' Function(AddMonths(startdaten , [ , mode])) in your specific case.

I.e. You are trying this...  >>   addweeks(DATE, -52)

Rather try this... >> AddMonths(DATE, -12)

 

Kind regards.