I am new to KNIME and I am having to calculate the number of working days between two dates - I have looked at other discussions but for some reason, they are not working for me. Maybe I am missing something/ doing something wrong?
For context: My data source has dates ranging from Jan 2019- May 2020.
One possible solution will be to use “Date&Time to String” node. In the Date Format field enter “eee”, this will transform the date to day name. Continue with “Rule engine” node and set a new column with values weekend and workdays something like this:
($Date$ = “Sat”) OR ($Date$ = “Sun”) => “weekend”
TRUE => “workday”
A second “Rule engine” is needed to set the range of days for example
($Date$>“2020-05-05T00:00”) AND ($Date$<“2020-05-15T00:00”) => “count”
TRUE => “not count”
And then use “Group by” to count workdays
Kind regards
Andrej
p.s. Maybe you need another table with holidays to tag and not count them
The calculations with dates are frequent and KNIME offers some nodes to do this but I do not know for the node that made calculations like “workday” and “networkdays” excel functions.
If this node doesn’t exist … it can be done or upgrade the “Date&time Diference” node to do this job?
Interesting topic. I created a workflow calculate_working_days.knwf (82.9 KB) that takes a table with two columns (startdate and enddate) as an input and returns the number of workingdays (Monday to Friday).
what about creating a date table like the sort of date dimensions used in data warehouses, where not even weekends, but also national holidays, company holidays, … are marked. If interested, I can provide a SQL-Script to create and fill such table. If once created, the table can be stored in database or even in excel and used again and again. Less than 3.700 rows for 10 years is not that much.