Skip to main content
Announcements
Join us at Qlik Connect for 3 magical days of learning, networking,and inspiration! REGISTER TODAY and save!
cancel
Showing results for 
Search instead for 
Did you mean: 
viveksingh
Creator III
Creator III

Custom weeks

Hi experts,
I have data like below
Week_st Week_end week
01/10/2018 05/10/2018 Week1
06/10/2018 12/10/2018 Week2
13/10/2018 25/10/2018 Week3

I want to creat week nunbers like week1,2,3,... based on above data

Expecting like below
Week_st Week_end week
01/10/2018 05/10/2018 Week1
06/10/2018 12/10/2018 Week2
13/10/2018 25/10/2018 Week3
01/10/2017 05/10/2017 Week1
06/10/2017 12/10/2017 Week2
13/10/2017 25/10/2017 Week3

Please help
14 Replies
qlikviewwizard
Master II
Master II

Hi,

Please try this.

 

Data:
LOAD DATE(Date#(Week_st,'DD/MM/YYYY')) as Week_st, DATE(Date#(Week_end,'DD/MM/YYYY')) as Week_end, week INLINE [
Week_st, Week_end, week
01/10/2018, 05/10/2018, Week1
06/10/2018, 12/10/2018, Week2
13/10/2018, 25/10/2018, Week3
];
Join(Data)
LOAD addyears (Week_st,-1) as Week_st,addyears (Week_end,-1) as Week_end,week Resident Data;Capture.PNG

qlikviewwizard
Master II
Master II

Hi Please try this.

 

Data:
LOAD DATE(Date#(Week_st,'DD/MM/YYYY')) as Week_st, DATE(Date#(Week_end,'DD/MM/YYYY')) as Week_end, week INLINE [
Week_st, Week_end, week
01/10/2018, 05/10/2018, Week1
06/10/2018, 12/10/2018, Week2
13/10/2018, 25/10/2018, Week3
];
Join(Data)
LOAD addyears (Week_st,-1) as Week_st,addyears (Week_end,-1) as Week_end,week Resident Data;

Capture.PNG

 

viveksingh
Creator III
Creator III
Author

Thanks for the reply. It is working fine.
Here I have date when I add week to pivot I’m not getting 2017 data.
qlikviewwizard
Master II
Master II

Please select Correct and Helpful to close the thread. Thank you.

qlikviewwizard
Master II
Master II

Hi,

Please try like this.

 

Data:
LOAD Year(DATE(Date#(Week_st,'DD/MM/YYYY')) ) as Year,DATE(Date#(Week_st,'DD/MM/YYYY')) as Week_st,
DATE(Date#(Week_end,'DD/MM/YYYY')) as Week_end, week
INLINE [
Week_st, Week_end, week
01/10/2018, 05/10/2018, Week1
06/10/2018, 12/10/2018, Week2
13/10/2018, 25/10/2018, Week3
];
Join(Data)
LOAD Year(addyears (Week_st,-1)) as Year,addyears (Week_st,-1) as Week_st,addyears (Week_end,-1) as Week_end,week
Resident Data;

 

Capture.PNGCapture1.PNG