Qlik Community

QlikView Scripting

Discussion Board for collaboration on QlikView Scripting.

Announcements
QlikView Fans! We’d love to hear from you.
Share your QlikView feedback with the product team… Click here to participate in our 5-minute survey.
Rules, plus terms and conditions, can be found here.
Not applicable

Networks days during the load

I have to calculate past 2 working days.

I have date field -createddate

07/30/2015

07/31/2015

07/25/2015

07/24/2015

How to calculate past 2 working days during the load.

I tried network days-doesn't work.

I can avoid Saturday and Sunday.

4 Replies

Re: Networks days during the load

Are you looking to create a flag for last two working days???

Re: Networks days during the load

Try the following script:

Table:

LOAD createddate,

  If(WeekDay(Today()) = 'Sun', If(createddate = Today()-2 or createddate = Today()-3, 1, 0),

  If(WeekDay(Today()) = 'Mon', If(createddate = Today()-3 or createddate = Today()-4, 1, 0),

  If(WeekDay(Today()) = 'Tue', If(createddate = Today()-4 or createddate = Today()-1, 1, 0),

  If(createddate = Today()-1 or createddate = Today()-2, 1, 0)))) as Flag;

LOAD Date(42004 + IterNo()) as createddate

AutoGenerate 1

While IterNo() <= 365;

Output:

Capture.PNG

Attaching the qvw for your reference as well.

HTH

Best,

Sunny

Re: Networks days during the load

Try,

LOAD *,

NetWorkDays(createddate-2,createddate) as WorkDays;

LOAD Date(42004 + IterNo()) as createddate

AutoGenerate 1

While IterNo() <= 365;

Please see the attached

MVP
MVP

Re: Networks days during the load

1.png


Table:

LOAD

  createddate,

  if(match(NetWorkDays(createddate, Today()),1,2), 1, 0) as Flag;

LOAD Date(makedate(2015) + IterNo()-1) as createddate

AutoGenerate 1 While IterNo() <= 365;

Community Browser