Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
Hi all,
To answer a certain question I need to find a date within a month, based on a calendar.
What I would like to have is this:
Month | First saturday | Second saturday | Third saturday | Fourth saturday | Fifth saturday |
---|---|---|---|---|---|
01 | 05-01-2013 | 12-01-2013 | 19-01-2013 | 26-01-2013 | - |
02 | |||||
03 | |||||
04 | |||||
05 |
Could anyone explain to me how I can find these dates with an expression?
I will need this date to use it in a variable.
Thanks.
Henco van Ee
Hi,
If you only want Saturday then you can do this in script like shown below.
Load Date, if(inweek(Date,Monthstart(Date)),if(WeekDay(Date)='Sat',1)) as First_Sat_Flag
From xyz;
Regards,
Kaushik Solanki
Hi Kaushik,
Thanks for your reply. I tried your suggestion, but unfortunately I can´t get it done.
I attached an example document, I hope you would like to take a look at it?
Thanks in advance.
Kind regards,
Henco
Try this
Load Date, if(inweek(Date,Monthstart(Date)),if(Date(Date,'WWW')='Sat',1)) as First_Sat_Flag
From xyz;
hope it helps
Hey Mate,
Kaushiks did not work for you because your system settings for daynames has set 'sat' to 'za'. I've attached a complete solution that gives you the saturday appearance for each calendar month.
If anyone knows a simpler approach, would love for you to show us
Otherwise, hope this is what you were looking for
Cheers,
Byron
Message was edited by: Byron_van_wy Edit Done - For completeness I added a pivot table with the set analysis 🙂
try this see attached.
Hi Hanco,
Try thr below application
-Anand
Try one of the fields created with this:
Calendar:
Load
Date
,WeekDay(Date) as WeekDay
,ceil(Day(Date)/7) as Week
,if(WeekDay(Date)='za', ceil(Day(Date)/7)) as SatNum
Resident Calendar_tmp;
See attached example.