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  this is not an easy question. Without specific customization we have to be pretty creative on this subject.

    I can imagine 2 possibilities:

    1. Roughly subtract weekend days given the difference between date start and date end

    Given the difference between date start and date end is 25 days, so we have between 3 and 4 weeks, so the business days is around 25 - 3 weekends, that means, business days = 19 days.

    I know, it is a roughly calculation

    2. Option 1 plus considering the weekday for both date start and date end

    Applying the sugarLogic function dayofweek on both date start and date end you will be able to identify the specific week day for both dates and to be able to precisely calculate the business days.

    I understand that you will need to create some custom fields to calculate some milestones for the whole calculation.

    I hope it sheds some light.

    André Lopes
    Lampada Global
    Skype: andre.lampada
Reply
  • Hi  this is not an easy question. Without specific customization we have to be pretty creative on this subject.

    I can imagine 2 possibilities:

    1. Roughly subtract weekend days given the difference between date start and date end

    Given the difference between date start and date end is 25 days, so we have between 3 and 4 weeks, so the business days is around 25 - 3 weekends, that means, business days = 19 days.

    I know, it is a roughly calculation

    2. Option 1 plus considering the weekday for both date start and date end

    Applying the sugarLogic function dayofweek on both date start and date end you will be able to identify the specific week day for both dates and to be able to precisely calculate the business days.

    I understand that you will need to create some custom fields to calculate some milestones for the whole calculation.

    I hope it sheds some light.

    André Lopes
    Lampada Global
    Skype: andre.lampada
Children
No Data