Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

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.

please suggest some method!!!!!

8 Replies
Anonymous
Not applicable
Author

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.......

Not applicable
Author

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.

Colin-Albert

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

Redefining the Week Numbers

Not applicable
Author

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 ?

MarcoWedel

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

Regards

Marco

Anonymous
Not applicable
Author

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

jldengra
Creator
Creator

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.

MarcoWedel

like this:

QlikCommunity_Thread_178116_Pic1.JPG

tabCalendar:

LOAD *,

    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;  

LOAD Date(MinDate+IterNo()-1) as Date

While MinDate+IterNo()-1 <= Today();

LOAD MakeDate(2014) as MinDate

AutoGenerate 1;

hope this helps

regards

Marco