Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
Hi All,
Can anyone help with the code to achieve the WEEK_NUMBER like 201601,201602,201603,....201652. Based on either Date or Week
column.
Example data for the Date and Week columns are
Thanks in Advance
Hi,
this should it be. I used a preceding load before the inline-load.
If this helps you please mark it as helpful or answerd.
KR Thomas
Table:
LOAD
*,
Year(Date#(Mid(Date,7), 'YYYY-MM-DD')) & Num(Week(Date#(Mid(Date,7), 'YYYY-MM-DD')), '00') AS Date_Week,
Year(Date#(Mid(Week,4), 'MM-DD-YYYY')) & Num(Week(Date#(Mid(Week,4), 'MM-DD-YYYY')), '00') AS Week_Week;
LOAD * INLINE [
Date, Week
SAT - 2015-06-27, Wk 06-22-2015
FRI - 2015-11-06, Wk 11-02-2015
SUN - 2015-06-21, Wk 06-15-2015
SUN - 2015-09-20, Wk 09-14-2015
FRI - 2015-12-18, Wk 12-14-2015
FRI - 2015-12-18, Wk 12-14-2015
WED - 2016-03-02, Wk 02-29-2016
SUN - 2015-06-21, Wk 06-15-2015
TUE - 2016-03-01, Wk 02-29-2016
FRI - 2015-11-06, Wk 11-02-2015
TUE - 2015-08-11, Wk 08-10-2015
SUN - 2015-09-20, Wk 09-14-2015
FRI - 2015-11-06, Wk 11-02-2015
];
What is the weeknumber for the same data you have provided? I guess what would be the output for the given data?
Hi,
this should it be. I used a preceding load before the inline-load.
If this helps you please mark it as helpful or answerd.
KR Thomas
Table:
LOAD
*,
Year(Date#(Mid(Date,7), 'YYYY-MM-DD')) & Num(Week(Date#(Mid(Date,7), 'YYYY-MM-DD')), '00') AS Date_Week,
Year(Date#(Mid(Week,4), 'MM-DD-YYYY')) & Num(Week(Date#(Mid(Week,4), 'MM-DD-YYYY')), '00') AS Week_Week;
LOAD * INLINE [
Date, Week
SAT - 2015-06-27, Wk 06-22-2015
FRI - 2015-11-06, Wk 11-02-2015
SUN - 2015-06-21, Wk 06-15-2015
SUN - 2015-09-20, Wk 09-14-2015
FRI - 2015-12-18, Wk 12-14-2015
FRI - 2015-12-18, Wk 12-14-2015
WED - 2016-03-02, Wk 02-29-2016
SUN - 2015-06-21, Wk 06-15-2015
TUE - 2016-03-01, Wk 02-29-2016
FRI - 2015-11-06, Wk 11-02-2015
TUE - 2015-08-11, Wk 08-10-2015
SUN - 2015-09-20, Wk 09-14-2015
FRI - 2015-11-06, Wk 11-02-2015
];
Hi Chanty 4u,
you marked my answer as helpful. What is missing to mark it as correct answer?
Do you need any explanation?