Discussion board where members can get started with Qlik Sense.
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
Not sure I understand your question. How is WeekEnd and Today() related, what do you mean?
Could you please explain how the above function works?
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))
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)?
Take a look at the weekend function here
1 will show one week forward, whereas -1 will take you one week back from your Today()-14 date. So
WeekEnd(Today()-14) is NOT equal to WeekEnd(Today()-14, 1, 0).
WeekEnd(Today()-14) = WeekEnd(Today()-14, 0, 0)
I hope this will clarify any left over doubts that you might have.