Qlik Community

New to Qlik Sense

Discussion board where members can get started with Qlik Sense.

Announcements
Qlik® Product Spotlight: Discover what’s possible. Get more from our products.
See for yourself. Register today.
shwetagupta
Contributor 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

Tags (1)
1 Solution

Accepted Solutions
Not applicable

Re: Create customised week

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,

5 Replies
arulsettu
Honored Contributor III

Re: Create customised week

have you tried

week(date field) as week

Not applicable

Re: Create customised week

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
Valued Contributor II

Re: Create customised week

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

Re: Create customised week

this is also a way to create week.

thanks

shwetagupta
Contributor II

Re: Create customised week

Hi Ankit,

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

(Missed to revert Sorry )