Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
I gave a table , contains Week start date and week end date and other columns ,
But i want to load the resident as week numbers also
1
2
3
4
5
6
7
8
9.........
..
..
..
..
52 as Week field.
How can i do that ....
thanks
LOAD Week(WeekStartDate) as Week
WeekStartDate,
WeekEndDate,
OtherColumns
From YourDataSource;
There are also other helpful functions regarding Weeks:
WeekYear, WeekName
hope this helps
regards
Marco
Thanks for your reply Macro.
I have already used it but problem is that it generates only week start numbers
1
5
9
14
18
22
27
31
36
40
44
49
But i need 1 to 49 series , the data related to week 1 is came for 2,3,4 also .
You can generate number from week(01/01/year) to week(31/12/year)
inside load ?
Please give me some script.
// -----> 41275 = 01/01/2013
// -----> 41640 = 01/01/2014
Orders:
Load
date(num(41275) + ceil(RowNo()/3)-1) as Date,
RowNo() as OrderNo,
if(odd(RowNo()),'Ext','Int') as OrderType,
if(right(RowNo()*2,1)=2,'Joan','Anna') as OrderCreator,
rand() * 1000 as OrderValor
autogenerate 2190;
//------------ FECHAS / Dates
LOAD
Date as xDate,
year(Date) as xYear,
month(Date) as xMonth,
day(Date) as xDay,
Num(week(Date), '00') as xWeek,
'Q' & ceil(Num(Month(Date))/3) as xQuarter,
'H' & ceil(Num(Month(Date))/6) as xHalf,
Num(Month(Date), '00') as xMonthNo,
MonthName(Date) as xMonthYear,
QuarterName(Date) as xQuarterYear,
year(Date)&'-Q'&ceil(Num(Month(Date))/3) as xYearQuarter,
year(Date)&'-'&Num(Month(Date),'00') as xYearMonth,
WeekYear(Date)&'-'&Num(Week(Date),'00') as xYearWeek,
WeekStart(Date) as xWeekStart,
WeekEnd(Date) as xWeekEnd,
WeekYear(Date) as xWeekYear,
dual(WeekDay(Date),num(WeekDay(Date))) as xWeekDay
resident Orders;
This script have other fields but I think is good for you
This is the QV file, with another elements
you probably need a calendar table.
Maybe this helps:
tabWeekCalendar:
LOAD *,
Week(MakeWeekDate(2014, IterNo())) as Week,
WeekYear(WeekDate) as WeekYear,
WeekName(WeekDate) as WeekName;
LOAD MakeWeekDate(2014, IterNo()) as WeekDate
AutoGenerate 1
While IterNo() <= 52;
regards
Marco