Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
Currently I have my week start on Sunday.
I'd like for my report to go back to the previous week start from the current date and count the previous 4 weeks from that date with the week starting on Sunday.
Currently I have my previous 4 weeks defined as
Date(Num(Date(Today(),'DD/MM/YYYY')-28)) AS Previous4Weeks,
if((TempDate <= today() and TempDate >= weekstart(today()-28)),1,0) as Previous4WeeksIND,
Try this:
Date(WeekStart(Today(), 0, 6) - 35) as Previous4Weeks,
If((Num(TempDate) <= Num(WeekStart(Today(), 0, 6) - 7) and
Num(TempDate) >= Date(WeekStart(Today(), 0, 6) - 35)), 1, 0) as Previous4WeeksIND
when you say previous week start, do you mean this: if today is 7/14/2015 -> Previous Week Start would be 7/12/2015 or 7/05/2015???
Previous Week start would be 7/5/2015 and it would go back 4 weeks
Try this:
Date(WeekStart(Today(), 0, 6) - 35) as Previous4Weeks,
If((Num(TempDate) <= Num(WeekStart(Today(), 0, 6) - 7) and
Num(TempDate) >= Date(WeekStart(Today(), 0, 6) - 35)), 1, 0) as Previous4WeeksIND
Worked like a charm, I didn't think about going back 35 days instead of 28. Thank you, Sunindia.
Not a problem
I am glad I was able to help.
Best,
Sunny