Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
I have a requirement to print the weekstart date from a given date.
I am using this function in Text Object
=(weekstart('5/31/2015'))
Now the above function returns 5/25/2015, which is last Monday.
But my requirements is, weeks should be from Saturday to Friday and not Monday to Sunday. So above expression should return 5/30/2015 (yesterday, Saturday)
I even tried to change the DayNames variable in Edit Script to start from Saturday, instead of Monday. But no luck.
Can you please help me how I can do this.
Thanks
Use dual WeekStart (date [, period_no = 0 [, week_start = 0]]) to get required value.
In your case :
=WeekStart('5/31/2015',0,5) results 5/30/2015
Try this
=Date(weekstart('5/31/2015')-2)
maybe
=weekstart('5/31/2015', 0, 5)
this is from Qlik help
WeekStart(date [, shift = 0 [,weekoffset = 0]])
Returns a value corresponding to a timestamp with the first millisecond of the first date ( Monday ) of the calendar week containing date. The default output format will be the DateFormat set in the script. Shift is an integer, where the value 0 indicates the week which contains date. Negative values in shift indicate preceding weeks and positive values indicate succeeding weeks. If you want to work with weeks not starting midnight between Sunday and Monday, indicate an offset in days in weekoffset. This may be given as a real number indicating days and/or fractions of a day.
Hi,
maybe this helps:
regards
Marco