Do not input private or sensitive data. View Qlik Privacy & Cookie Policy.
Skip to main content

Announcements
Want to see what's currently in public preview? We've pulled it all together in one place. Check it out here
cancel
Showing results for 
Search instead for 
Did you mean: 
shwetagupta
Partner - Creator II
Partner - Creator II

Create customised week

Hi All

I have to create customised week i.e from first month of the day to 7th day it should be week one

1-july-2016 - 7 july 2016  : Week 1

8-july-2016 - 14 july 2016  : Week 2

15-july-2016 - 21 july 2016  : Week 3

22-july-2016 - 31july 2016  : All the remaining day

This I have to do for all the months of the year in load script.

Can someone suggest how should I go ahead.?

Shweta

1 Solution

Accepted Solutions
Not applicable

hi u can try this here i am using calendar_date from master calendar , i am sure u have also created master calendar in your script.

Load this in your load script.

IF(num(Left(Calendar_Date,2))<=7,'week1',

        IF(num(Left(Calendar_Date,2))>=8 And num(Left(Calendar_Date,2))<=14,'week2',

   IF(num(Left(Calendar_Date,2))>=15 And num(Left(Calendar_Date,2))<=21,'week3',

                IF(num(Left(Calendar_Date,2))>=21 ,'rest of the day'))))  As  Monthly_week_Bucket_Master,

View solution in original post

5 Replies
arulsettu
Master III
Master III

have you tried

week(date field) as week

Not applicable

hi u can try this here i am using calendar_date from master calendar , i am sure u have also created master calendar in your script.

Load this in your load script.

IF(num(Left(Calendar_Date,2))<=7,'week1',

        IF(num(Left(Calendar_Date,2))>=8 And num(Left(Calendar_Date,2))<=14,'week2',

   IF(num(Left(Calendar_Date,2))>=15 And num(Left(Calendar_Date,2))<=21,'week3',

                IF(num(Left(Calendar_Date,2))>=21 ,'rest of the day'))))  As  Monthly_week_Bucket_Master,

MindaugasBacius
Partner - Specialist III
Partner - Specialist III

What about this:

if(day(Date) <= 7, 'Week 1',

  if(day(Date) <= 14, 'Week 2',

     if(day(Date) <= 21, 'Week 3', 'Week 4'))) as [Week of the month]

Not applicable

this is also a way to create week.

thanks

shwetagupta
Partner - Creator II
Partner - Creator II
Author

Hi Ankit,

Thanks a lot for your reply. It just fit into my situation well.

(Missed to revert Sorry )