Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 
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
sunny_talwar

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

sunny_talwar

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

Kushal_Chawda

Try,

LOAD *,

NetWorkDays(createddate-2,createddate) as WorkDays;

LOAD Date(42004 + IterNo()) as createddate

AutoGenerate 1

While IterNo() <= 365;

Please see the attached

maxgro
MVP
MVP

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;