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

Announcements
Qlik Open Lakehouse is Now Generally Available! Discover the key highlights and partner resources here.
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

Need help on dates

Hi All

Need to generate Periods for date field by taking each period as 2 weeks

[like

1,2 --->      P1

3,4 --->      P2

5,6---->       P3

7,8 --->      P4

9,10 ---->     P5

11,12 ---->       P6

13,14---->      P7

15,16--->      P8

]

Regards

John

7 Replies
jpenuliar
Partner - Specialist III
Partner - Specialist III

Have a look a Mapping Load Techniques

jpenuliar
Partner - Specialist III
Partner - Specialist III

rubenmarin

Hi John, quick answer will be:

create a field like: Ceil(Week(DateField)/2) & 'P'

but for some dates like '01/01/2012' it will return 26 (as 01/01/2012 is part of the week 52 of 2011)

If you want to start like 01/01/year will be always in week 1, you can use:

Ceil(Floor(DayNumberOfYear(DateField) + WeekDay(YearStart(DateField))/7)/2) & 'P'

Anonymous
Not applicable
Author

Hi,

you can have a more column in your table called WEEK

then load a inline with two column WEEK and Period assign values like below

and use Period for rest of the calculation

l

LFET JOIN(DATE_TABLE)           //(your table)

PERIOD:

LOAD * INLINE [

WEEK,PERIOD

1, P1

2, P1

3, P2

4, P2

5, P3

6, P3

7, P4

8, P4

9, P5

10, P5

11, P6

12, P6

13, P7

14, P7

15, P8

16, P8

];

Anonymous
Not applicable
Author

Is your problem resolved ??

Anonymous
Not applicable
Author

Hi

Use if Condition

If(Week>=1 and Week <2 ,'P1',

If(Week>=3 and Week <4 ,'P2'))

Like this

or

u can use the inline table or use the interval match function..........

Not applicable
Author

Not yet i am working on that