Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

Weekly sales

I want to get table of weekly (week by week) sales starting 2015-01-01. Should i write calendar measure for each week ?  

1 Solution

Accepted Solutions
vinieme12
Champion III
Champion III

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)

Vineeth Pujari
If a post helps to resolve your issue, please accept it as a Solution.

View solution in original post

5 Replies
sibusiso90
Creator III
Creator III

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.

ecolomer
Master II
Master II

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;

vinieme12
Champion III
Champion III

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)

Vineeth Pujari
If a post helps to resolve your issue, please accept it as a Solution.
sibusiso90
Creator III
Creator III

You will use week as your dimension in this case.

Not applicable
Author

Can not open qlikview file, i am using qliksense