8 Replies Latest reply: Aug 30, 2015 6:29 PM by Marco Wedel

# Weeks

H iii,

I have Data for Two Months July 2015 and august 2015.

specific data (1 July to 22 august).

i created  Weeks Field Representing week 1,week 2.....   against every date.

but since august 1st week consist of two days only Saturday and Sunday.

the week number(week 1 ,week 2) is placed for whole week starting from Monday to Sunday which takes 5 days of july and 2 days of august.

my requirement is to make last week of July from Monday to Thursday and first week of august consisting of  Saturday and Sunday.

• ###### Re: Weeks

Well, this is the functionality of Week().

As per my understanding, you need to hard code it at script level or UI level..

something like this:

If(Date>1st of month and Date<=7th of month, Week1,

If(Date>7th of month and Date<=14th of month, week2,

like this.......

• ###### Re: Weeks

week 1,week 2 ..... have been created by me .

but i want the restriction that if week has got 4 days in it then it should end at that day only and next week should be there for rest days of  week.

• ###### Re: Weeks

sounds like you need to create another inline dimension for date with a flag field 0 and 1 with 1 being start of the consecutive week.manually pickout all dates say in the next 2 years ?

• ###### Re: Weeks

If(Date>1st of month and Date<=7th of month, Week1,

If(Date>7th of month and Date<=14th of month, week2,

If(Date>14th of month and Date<=21st of month, Week3,

If(Date>21st of month and Date<=28th of month, week4,

If(Date>28st of month and Date<=31st of month, week5

This is hard coded, it wud repeat for every month from week1 - week5

• ###### Re: Weeks

There is a good discussion of Week Numbers and the complexity of the issues this raises here.

Redefining the Week Numbers

• ###### Re: Weeks

Autonumber(WeekName(yourdate), MonthName(yourdate))

Regards

Marco

• ###### Re: Weeks

like this:

```tabCalendar:
Day(Date) as Day,
WeekDay(Date) as WeekDay,
Week(Date) as Week,
WeekName(Date) as WeekName,
Month(Date) as Month,
MonthName(Date) as MonthName,
Dual('Q'&Ceil(Month(Date)/3),Ceil(Month(Date)/3)) as Quarter,
QuarterName(Date) as QuarterName,
Year(Date) as Year,
WeekYear(Date) as WeekYear,
Autonumber(WeekName(Date), MonthName(Date)) as WeekNumber;
While MinDate+IterNo()-1 <= Today();
AutoGenerate 1;
```

hope this helps

regards

Marco

• ###### Re: Weeks

My suggestion is to make use of the following key, instead of week1, week2, ... as week identifier, since its order is compatible with the chronological order as well as it enables distinguishing two different weeks whenever a week is between two consecutive months:

100 * Week(DateField) + Num(Month(DateField))

The first two digits represent the week number and the last two digits denote the month.

Thus, for example, the last week of July is splitted into two weeks for your data: the week 3107 for the days of July and the week 3108 for the days of August, the second week of August will be 3208, and so on an so forth.

I hope this helps.