Hi all,
I am trying to create a calendar having each week start on Thursday. I have read and applied various ideas from many posts but I still have a problem; the week number. In my case, The first week of the year starts from the first day of the year BUT it lasts until the first Wednesday of the year. For example, for year 2013 we shall have:
Date | Day | Week Number |
---|---|---|
1/1/2013 | Tuesday | 1 |
2/1/2013 | Wednesday | 1 |
3/1/2013 | Thursday | 2 |
4/1/2013 | Friday | 2 |
5/1/2013 | Saturday | 2 |
6/1/2013 | Sunday | 2 |
7/1/2013 | Monday | 2 |
8/1/2013 | Tuesday | 2 |
9/1/2013 | Wednesday | 2 |
10/1/2013 | Thursday | 3 |
... | ... |
Any ideas of how I achieve that?
Thanking you in advance,
Greg
Not if you change the variable that defines the minimum number of days in week one to 1:
Set vMinDaysInWeek = 1; // Minimal number of days in week no 1. (For the U.S. = 1)
HIC
There is a script that does this in one of my blog posts: Ancient Gods and Modern Days
HIC
Hi,
Try this.
let vMinDate = num(MakeDate(2012,01,01));
Let vMaxDate = num(MakeDate(2012,12,31));
Load Date($(vMinDate) + RowNo() -1) as Date,
Week(Date($(vMinDate) + RowNo() -1)) as Week,
WeekDay(Date($(vMinDate) + RowNo() -1)) as WeekDay,
num(WeekDay(Date($(vMinDate) + RowNo() -1))) as WeekDayNum,
week(WeekStart(Date($(vMinDate) + RowNo() -1),0,3)) as NewWeek
AutoGenerate 1
While Date($(vMinDate) + RowNo() -1) < Date($(vMaxDate));
This might not what you want, but i am sure this will help you to understand and then you can develop by our own.
Regards,
Kaushik Solanki
Thank you
I have extensively used this exact post.
I think the problem is that the duration of week one is not static (7 days from the day I have defined as the first day of week).
In your example, week 1 would start from 3/1/2013 and the previous days will be week 52.
Not if you change the variable that defines the minimum number of days in week one to 1:
Set vMinDaysInWeek = 1; // Minimal number of days in week no 1. (For the U.S. = 1)
HIC
Hi,
Try lunarweek(),
=SubField(LunarWeekName(DateDimension), '/', 2)
Hope this helps you.
Regards,
Jagan.
Hi,
Check whether below script helps you.
LOAD
Date,
Month(Date) as Month,
WeekDay(Date) as Day,
Num(WeekDay(Date)) as WkDay,
If((Day(Date)=1) and (Month(Date)=1),1,
If(Num(WeekDay(Date))=3,Peek('WeekNo')+1,Peek('WeekNo'))) as WeekNo;
Resident YourTable;
One thing here is your Date field should have value starts from 1st January.
regards
GowriShankar
Thank you, you are right, I missed sth on the script.
Kind Regards,
Greg