Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
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!
If i've understood correctly, below should work for you
NetWorkDays(dt1 + if(weekday(dt1 )>=5, 8-weekday(dt1) ,1) , today() )
If i've understood correctly, below should work for you
NetWorkDays(dt1 + if(weekday(dt1 )>=5, 8-weekday(dt1) ,1) , today() )
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()