Date Difference

hari2603
Level 1
Date Difference

Hi

I want to calculate Date difference between 2 columns by excluding the weekends. I was wondering is there any formula by which I can calculate the same in the Visual Recipe. I however managed to solve this using Python Code recipe but I want to do the same in Visual Recipe. 

Thanks

0 Kudos
1 Reply
fchataigner2
Dataiker
Dataiker

If you have Python code able to perform the computation, then you can use it in a Prepare recipe on a row-by-row basis. You can also probably replicate your computations with the Extract date component processor (to get the dayOfWeek of the start and end dates), the Compute difference processor (to compute the number of days between the 2 dates) and a bit of Formula step.

For a purely visual approach, you'll need to have a dataset of the dates of the non-weekend days (possibly the non-holiday dates too) covering the time range present in your dataset, use a join recipe from you dataset on the non-weekend days to retrieve the days where start <= non-weekend-day <= end, then a Grouping recipe to count the number of non-empty non-weekend-day joined.

Public