Do not input private or sensitive data. View Qlik Privacy & Cookie Policy.
Skip to main content

Announcements
See why IDC MarketScape names Qlik a 2025 Leader! Read more
cancel
Showing results for 
Search instead for 
Did you mean: 
JonesBeach
Contributor III
Contributor III

Network day takes away a day from age if somethings beginning date is on a weekend, can someone please help resolve this!!

I am trying to use the formula below:

load *, num(if(Location= 'Newport', NetWorkDays(dt1 +1, today(), $(vPublicHolidays_USA)), NetWorkDays(dt1 +1, today(), $(vPublicHolidays_ASIA)))) as diff;
load*,
date(floor(Start_Date) )as dt1;

LOAD ItemID,
Location,
"Dispatched_Date" as Start_Date
Resident Product_Sales;

As you can see I am adding a day to the Start_Date i,e dt1 so that I dont count the day an Item was dispatched but this is causing a problem when an Item is dispatched on a weekend that is a saturday or a sunday. So Incase an item is dispatched on 27thNov2022 then on the 6thDec2022 it should be 6 days but its showing 7. I tried nesting another if statement but wasnt successful as the network formula takes away the weekends already. Any help is much appreciated. Thanks!

Labels (3)
1 Solution

Accepted Solutions
vinieme12
Champion III
Champion III

If i've understood correctly, below should work for you

 

NetWorkDays(dt1  + if(weekday(dt1 )>=5, 8-weekday(dt1) ,1)  , today() )

 

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

View solution in original post

2 Replies
vinieme12
Champion III
Champion III

If i've understood correctly, below should work for you

 

NetWorkDays(dt1  + if(weekday(dt1 )>=5, 8-weekday(dt1) ,1)  , today() )

 

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

Hi Vineeth that was neat but I just altered it a little bit and it worked fine. Thanks for the idea i didnt even know that a weekday function existed in Qlik Sense. 

Here's the change I made:

NetWorkDays(if(weekday(dt1), dt1 + 1,dt1 + 2) , today()