Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
Dear All,
As you all know ...the networkday() function excluding saturday and sunday from TAT calculation. However i want to exclude friday also or the day which i want to exclude from TAT calculation...
is there any way to achieve this ...if yes how i can implement the same.
help would be much appreciated...
Sarfaraz
Hi Sarfaraz,
In this case, you can use third parameter holiday list in Networkdays() function. First, create a load script to capture all Fridays and store them in a variable. After doing that, you can use the variable in Networkdays() function as third parameter. Here is an example,
Let vMinDate = Num(MonthStart(Today()));
Let vMaxDate = Num(Today());
Holiday:
Load Concat(Chr(39) & Date & Chr(39) ,', ' ) as Date Where Weekday(Date)='Fri';
Load Date($(vMinDate)+iterno()-1) as Date
Autogenerate 1 While $(vMinDate) + Iterno() -1 <= $(vMaxDate);
Let vHoliDays = Peek('Date',0,'Holiday')
Drop table Holiday;
Now, you can use the variable like Networkdays(StartDate, EndDate. $(vHoliDays))
In above example, I just took current month start date as start date and today's date as end date for understanding. You can find vMinDate and vMaxDate from your source table like below,
Temp:
LOAD
Min(DateFieldName) as MinDate,
Max(DateFieldName) as MaxDate
Resident SourceTableName;
LET vMinDate = Peek('MinDate');
LET vMaxDate = Peek('MaxDate');
Drop Table Temp;
You can concatenate holiday list other than Friday (as well) in holiday table.
Hope this helps.