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: 
bhawana
Contributor II
Contributor II

Last week current year vs Last week last year date

Hi all,

I need to create last week this year vs last week last year date. I tried creating last weeks date which looks fine but unable to create last week last year date.

Date ranges from 2017 to 2019 .

DATE = '>=$(=WeekStart( Today()-6)) <=$(=Date(WeekEnd( Today())-7))'

Could anyone please help me?

Thanks in advance

3 Replies
Anil_Babu_Samineni

Perhaps this?

DATE = '>=$(=WeekStart(AddYears(Today()-6, -1))) <=$(=Date(WeekEnd(AddYears(Today(), -1))-7))'

Best Anil, When applicable please mark the correct/appropriate replies as "solution" (you can mark up to 3 "solutions". Please LIKE threads if the provided solution is helpful
bhawana
Contributor II
Contributor II
Author

My last week ranges from 9/8/2019 -9/14/2019 and your last week last year ranges from 9/9/2018- 9/14/2015. OI am not sure why is this happening , 

Is there a better way to do last weeks date without using today -6 or today -7 ?

vMax=2019

vMin =2017 

Please help.

StarinieriG
Partner - Specialist
Partner - Specialist

Hi,

maybe instead of Today()-6 or Today()-7 you could use MakeWeekDate function

For example

DATE = '>=$(=Date(WeekStart(MakeWeekDate(Year(Today()),Week(Today())-1)))) <=$(=Date(WeekEnd(MakeWeekDate(Year(Today()),Week(Today())-1))))'