This topic contains 3 replies, has 0 voices, and was last updated by Dew 7 years ago.

  • Author
    Posts
  • #22691 Score: 0

    rgoldstein
    • Contributions: 0
    • Level 1

    I'd like a saved search formula that calculates the number of days between two dates, but exclude weekends.

    So if it was 10/10/2017 minus 10/6/2017, the result would be 2 (counting only business days and excluding the Saturday and Sunday). A

    Anyone have an example saved search I can reference? Thanks!
    This is a cached copy. Click here to see the original post.

  • #22692 Score: 0

    khultquist
    • Contributions: 0
    • Level 1

    I thought there was a thread about this, and did a quick check of the user group but couldn't find it.

    This should be possible to create using MOD, CASE, TO_CHAR and TO_NUMBER.

  • #22693 Score: 0

    pcutler
    • Contributions: 0
    • Level 1

    I believe this would be a case statement with slightly different formulas depending on the day of the week. There are some answers here:

    https://stackoverflow.com/questions/…s-or-procedure

  • #22694 Score: 0

    Dew
    • Contributions: 0
    • Level 1

    I picked this up on the forum somewhere, don't know who to thank, but to calculate business days between transaction date and today's date use:

    Code:
    TRUNC((TRUNC(SYSDATE)-TRUNC({TRANDATE}))/7)*5 + MOD(TRUNC(SYSDATE)-TRUNC({TRANDATE}),7) – CASE WHEN TO_NUMBER(TO_CHAR(TRUNC(SYSDATE),'D')) < TO_NUMBER(TO_CHAR({TRANDATE},'D')) THEN 2 ELSE 0 END

You must be logged in to reply to this topic.