How to remove weekend days from formula to count days between two date?

We have a field on our custom approvals records module that counts the days between the start of the process to the approved date with the following formula. 

ifElse(greaterThan(strlen(toString($date_approved_c)),0),add(subtract(daysUntil($date_approved_c),daysUntil($process_start_date_c)),1),"")

how can we exclude weekends?

We have SLAs we want to put out and enforce with approval teams but knowing the data is skewed to include weekends, it doesn't seem fair to do so until we have a solve for removing weekend. Most approvals will happen within less than a day so also looking to see how to turn this into hours, then I'll need business hours. We do not have business centers in place yet either. 

Parents
  • Hi  ,

    André and Harald raise valid approaches to solving your business need. I had considered how many nested ifElse statements and dependent calculations  it would require to accurately calculate the number of business days and it quickly spiraled!

    As a simpler approach, we decided yesterday to add some new SugarLogic functions to our Upsert Calculated Fields plugin:

    • uafCountBusinessDays - counts business days between two dates
    • uafCountBusinessHours - counts business hours between two dates
    • uafCountBusinessMinutes - counts business minutes between two dates
    • uafBusinessDaysSince - counts business days lapsed since a date
    • uafBusinessDaysUntil - counts business days to go until a date

    These formulas all calculate business days based on a standard Monday - Friday workweek. The nice thing about the formulas is that there are optional parameters to also specify a time zone and specific operating hours of the week or by each day. Here is sample of what the formulas look like:

    The formulas support integer or decimal output. Here is what the various formulas look like on a task record with a start and due date:

    If you would like to learn more about Upsert Calculated Fields and how these formulas can help measure your SLAs, please contact us via our website!

    Chris

  • Great response Chris!  I'm impressed that Upsert has so quickly added the function. 

    Bud Hartley | Cape Foulwind, NZ (and Oregon, USA)

Reply Children
No Data