5 Replies Latest reply: Sep 28, 2016 1:03 PM by Sunny Talwar

# Dates

Can someone please explain how this function works

(If(Date(Date1)<WeekEnd(today()-14,1,0) and Date(Date1)>=WeekEnd(today()-21,1,0), Date1))

How is weekend and today related here

• ###### Re: Dates

Not sure I understand your question. How is WeekEnd and Today() related, what do you mean?

• ###### Re: Dates

Hi Sunny,

Could you please explain how the above function works?

Thanks,

Ankit

• ###### Re: Dates

Where are you using this? As a calculated dimension?

I think it is trying to list date for last week. When I checked WeekEnd(today()-14,1,0) it showed me last weekend date 9/25/2016

And this -> WeekEnd(today()-21,1,0) give me last week start date 9/18/2016

So, from the looks it seems that the expression is grabbing Date1 between 9/18/2016 to 9/25/2016 (the last completed week). May be an easier way to write this would be this,

If(Date1 >= WeekStart(Today(), -1, 0) - 1 and Date1 < WeekEnd(Today(), -1, 0), Date1))

• ###### Re: Dates

Thanks,Sunny that was very useful,i am not sure how why does ,1,0  signifies in WeekEnd(today()-14,1,0)?

can't we just use WeekEnd(today()-14)?