Skip to main content
Announcements
Have questions about Qlik Connect? Join us live on April 10th, at 11 AM ET: SIGN UP NOW
cancel
Showing results for 
Search instead for 
Did you mean: 
Anonymous
Not applicable

How to show 1st week sales in weekly .

Hello Experts,

 

          I have data with dates and sales . When  i extract  data into qlikview it shows in the 2nd week of this month.Iam using below expression for find Month_week.

if(month(weekend(Date))= month(Date),div(day(WeekEnd(Date)),7),div(day(Weekend(Date,-1)),7)+1)+1 as Month_Week;


Please give me a solution to solve this task and iam attaching one file .

Thanks in advanced,

suman.

2 Replies
captain89
Creator
Creator

Hi,

so you would divide months in weeks.

But when a month starts on saturday like Sep-18... Is the first week (one) an only 2days week?

captain89
Creator
Creator

Try this:

Tab:

load

year(Date)*100+week(Date) as Week,

date(Date) as Date,

Sales

FROM

[Book1 (1).xls]

(biff, embedded labels, table is Sheet1$);

Concatenate

load

year(min(Date-1))*100+week(min(Date)-1) as Week,

date(min(Date-1)) as Date,

0 as Sales

FROM

[Book1 (1).xls]

(biff, embedded labels, table is Sheet1$);

Tab2:

load*,

if(previous("Week")=Week, Previous("Week"), Previous(Week)+1) -

(year(Date)*100+Week(MonthStart(Date, 0)))+1 as month_week

resident Tab Order by Date;

drop table Tab;