Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
Hi experts.
I'm looking for some way to get calendar options from today() function,
Can QV get date for last thursday for current month using today()?
For example, in dimension i need to get 29.12.2016
Thanks.
If you are specifically searching for the last thursday of a month, then maybe use something like
=DayName(Monthend(today())- Mod(Weekday(Monthend(today()))-3,7))
Thanks.
Could you explain me please, how it works?
From Reference Manual Help:
lastworkdate(start_date, no_of_workdays {, holiday})
Returns the earliest ending date to achieve number_of_workdays (Monday-Friday) if starting at start_date taking into account any optionally listed holidays. Start_date and holiday should be valid dates or timestamps.
Examples:
lastworkdate ('2007-02-19', 9) returns '2007-03-01'
lastworkdate ('2006-12-18', 8, '2006-12-25', '2006-12-26') returns '2006-12-29'
Try this?
= FirstWorkDate(Monthend(Today()), 2)
If you are specifically searching for the last thursday of a month, then maybe use something like
=DayName(Monthend(today())- Mod(Weekday(Monthend(today()))-3,7))
Only works for some months. For days in November, for instance, it will return 11/29/16, which is a Tuesday.
Oops I missed that. Thanks John for that.
Or if you want to flag dates in your master calendar, you can do it like
LOAD *,
if(Weekday(Date) =3 and Day(Date) >Day(Monthend(Date))-7,1,0) as Flag1,
If(Date = Floor(Monthend(Date)- Mod(Weekday(Monthend(Date))-3,7)),1,0) as Flag2
;
LOAD *, Weekday(Date) as Weekday;
LOAD Date(Makedate(2016,1,1)+recno()-1) as Date
AutoGenerate 365;
Date | Weekday | Flag1 | Flag2 |
---|---|---|---|
28.01.2016 | Do | 1 | 1 |
25.02.2016 | Do | 1 | 1 |
31.03.2016 | Do | 1 | 1 |
28.04.2016 | Do | 1 | 1 |
26.05.2016 | Do | 1 | 1 |
30.06.2016 | Do | 1 | 1 |
28.07.2016 | Do | 1 | 1 |
25.08.2016 | Do | 1 | 1 |
29.09.2016 | Do | 1 | 1 |
27.10.2016 | Do | 1 | 1 |
24.11.2016 | Do | 1 | 1 |
29.12.2016 | Do | 1 | 1 |
Dears, thanks for help!