Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
I want to get table of weekly (week by week) sales starting 2015-01-01. Should i write calendar measure for each week ?
create a master calendar with week number or week name as Enrique has shown above.
create a pivot table with Week and Other dimension(s) that you need and using set analysis restrict the number of weeks data that you want to see in the table.
if you want to see just last 2 weeks then restrict as below\\\
example
sum({ <WeekNum = {">=Max(WeekNum)-1<=Max(WeekNum)"}> }Sales)
Use the function Week('date').
it will return the week number.
You can simulate the whole year and also simulate the week number then you have your week.
If you have date for each sales, you can have sales by week also.
example to generate :
let vMinDate = num(Peek('date',0,'Test'));
let vMaxDate = num(Peek('date',-1,'Test'));
LET vToday = vMaxDate;
TempDate:
Load date($(vMinDate)+RecNo()-1) as TempDate
AutoGenerate $(vMaxDate) -$(vMinDate);
TimeDim:
LOAD
//AutoNumber(TempDate) as DayKey,
TempDate as date,
Month(TempDate) as Month,
Month(AddMonths(TempDate,-1)) as Pre_Month,
Day(TempDate) as Day,
DayName(TempDate) as DayName,
num(Month(TempDate)) as MonthID,
'Q'&Ceil(num(Month(TempDate))/3) as Quarter,
'W'&Ceil(Day(TempDate)/7) as Week,
'W'&Ceil(Day(TempDate)/7) as Week123,
year(TempDate) as Year,
//Hour(TempDate) as Hour,
Month(TempDate) &'-'& Year(TempDate) as MonthYear,
year(TempDate) &'-'& 'Q'&Ceil(num(Month(TempDate))/3) as YearQtr,
if(year([TempDate])=year(today()), 1, 0) as CY_flag,
if(year([TempDate])=(year(today())-1), 1, 0) as LY_flag,
'Quarter' & Ceil(Month(TempDate)/3) & '(' & Year(TempDate) & ')' AS QuarterYear,
WeekYear(TempDate) as weekyear,
WeekDay(TempDate) as Weekday
Resident TempDate;
DROP Table TempDate;
create a master calendar with week number or week name as Enrique has shown above.
create a pivot table with Week and Other dimension(s) that you need and using set analysis restrict the number of weeks data that you want to see in the table.
if you want to see just last 2 weeks then restrict as below\\\
example
sum({ <WeekNum = {">=Max(WeekNum)-1<=Max(WeekNum)"}> }Sales)
You will use week as your dimension in this case.
Can not open qlikview file, i am using qliksense