Hi,
i’m trying to exclude bank holidays from netWorkDays
calculation. Additionally i want to exclude 1 day for each record. I’m utilizing below formula and it’s partially working. However I’ve spotted some scenarios for instance: if {date1} = bank holiday, then bank holiday isn’t excluded from calculation. Is there anything I can improve within my formula? I’m utilizing Postgre SQL as a datasource.
netWorkDays({date1},{date1})
-
(
ifelse({date1} <= '2023-01-02' AND '2023-01-02' <= {date1}, 1, 0) +
ifelse({date1} <= '2023-01-06' AND '2023-01-06' <= {date2}, 1, 0) +
ifelse({date1} <= '2023-01-16' AND '2023-01-16' <= {date2}, 1, 0) +
ifelse({date1} <= '2023-02-20' AND '2023-02-20' <= {date2}, 1, 0) +
ifelse({date1} <= '2023-04-10' AND '2023-04-10' <= {date2}, 1, 0) +
ifelse({date1} <= '2023-05-01' AND '2023-05-01' <= {date2}, 1, 0) +
ifelse({date1} <= '2023-05-03' AND '2023-05-03' <= {date2}, 1, 0) +
ifelse({date1} <= '2023-05-29' AND '2023-05-29' <= {date2}, 1, 0) +
ifelse({date1} <= '2023-06-08' AND '2023-06-08' <= {date2}, 1, 0) +
ifelse({date1} <= '2023-06-19' AND '2023-06-19' <= {date2}, 1, 0) +
ifelse({date1} <= '2023-07-04' AND '2023-07-04' <= {date2}, 1, 0) +
ifelse({date1} <= '2023-08-15' AND '2023-08-15' <= {date2}, 1, 0) +
ifelse({date1} <= '2023-09-04' AND '2023-09-04' <= {date2}, 1, 0) +
ifelse({date1} <= '2023-11-01' AND '2023-11-01' <= {date2}, 1, 0) +
ifelse({date1} <= '2023-11-23' AND '2023-11-23' <= {date2}, 1, 0) +
ifelse({date1} <= '2023-11-24' AND '2023-11-24' <= {date2}, 1, 0) +
ifelse({date1} <= '2023-12-25' AND '2023-12-25' <= {date2}, 1, 0) +
ifelse({date1} <= '2023-12-26' AND '2023-12-26' <= {date2}, 1, 0) +
) -1
results:
1st record returns expected value = 1
2nd record returns suspect value = 3 (expected 2)
However when tested the same data, uploaded as excel file i’m getting correct values:
Looking forward for any hints, thanks.
@ArunSanthosh i saw your post on similar case (How to calculate work days?), would you be able to take a look? I’ve tested out your solution but ended up with the same output.