Number of Days between two Day Names

  • Lynn Pettis - Wednesday, May 9, 2018 4:23 PM

    ScottPletcher - Wednesday, May 9, 2018 3:55 PM

    Lynn Pettis - Wednesday, May 9, 2018 3:34 PM

    ScottPletcher - Wednesday, May 9, 2018 2:48 PM

    Lynn Pettis - Wednesday, May 9, 2018 9:49 AM

    ScottPletcher - Wednesday, May 9, 2018 7:40 AM

    Lynn Pettis - Tuesday, May 8, 2018 4:20 PM

    patrickmcginnis59 10839 - Tuesday, May 8, 2018 3:45 PM

    Except that the requirement here was to determine if an order is shipped within the SLA.  This is not a scheduling issue.  Did orders received 2018-05-07 ship no later than 2018-05-08? If any shipped on 2018-05-09 (or later) those orders did not meet the SLA. Did orders received on 2018-05-11 or 2018-05-12 or 2018-05-13 ship 2018-05-14? If any shipped on 2018-05-15 (or later) those orders did not meet the SLA.

    With this you also need to take into account the possibility of an order being delayed for several weeks.

    The OP never mentioned an SLA that I recall.  That was posited later.  The full initial q was:

    I have a table with a Start Day and a End Day Column

    ID StartDay EndDay
    1 Monday Friday
    2 Tuesday Wednesday
    3 Friday Monday

    I need to calculate number of days between StartDay and EndDay

    For Example;
    ID 1 would be 4 
    ID 2 would be 1
    ID 3 would be 3

    And like almost every other initial post by people asking for help, we were given just a small piece of the problem.  The OP did provide more information later.  That should have changed the direction of the discussion.

    It didn't really:

    I was tasked with figuring out if an Service level agreement on Shipping an order was met and that goes by Day of the week. Orders coming in on Monday (Any Monday) need to ship by Tuesday, Orders from Friday, Saturday or Sunday need to ship by Monday. If they ship any day beyond the set End day the Service level agreement is not met. I approached the calculation by building a table like the one in the initial post 

    That is not different than the initial post.  You still first need to calc just the (generic) days diff from the the day the Order came in.  Then you compare that to the actual shipping days based on the dates in the shipments.  That in no way requires changing the original day name to give it a date; indeed, that's not really directly viable.

    Okay.  Order comes in Monday and ships on Tuesday.  Did it meet the SLA?  Answer, I don't know without know what Monday and what Tuesday.  You only know that if you have the actual dates.

    It's known to be within a week, as specified.  Normal shipment times don't exceed a week.  Sure, there could be some exception, but not 99% of the time. 

    Yet again:
    The general SLA is just days.  The actual order and actual shipment have specific dates.  I don't see why that's so difficult to accept.

    Normal and exceptions go hand in hand.  I have worked for a company that shipped products to customers.  You have to be able to handle the exceptions since nothing always goes according to plan.

    I think the OP's plan might have been to get the correct dates using the day of week table according to the original spec. I also think some of the assumptions here were that using the day of week rules the OP listed originally PRECLUDED calculating actual dates at any time when in actuality, the rules might have actually ASSISTED in calculating the actual dates. I can't quite tell from other posters whether using the rules were bad news or not. Can we tell if the OP can solve his problem without a list of rules aligned with the days of week yet?  I'm thinking that even if we work with actual dates at the moment of instantiation, the OP might still need to consult some table of rules according to the day of week, but he also might be able to do this without producing a list of differences between days of the week even if that could be done unambiguously as I believed he could according to the original request.

    So whadya say OP, do you still plan to calc those differences? Do you think it will work? Just curious, in case you're still around after the thread exploded 😉

  • I think none of the replies made any sense, mainly because OP failed to analize and understand the business case.

    I strongly believe that Friday orders must be shipped on Monday, unless it's Easter Monday.

    Or Chistmas Day, or Banking holiday.

    The request must be formed like this:

    Shipping on the 2nd working day since Order Date, counting the Order Day (if it's a working day then it's Day1, if not it's Day0)

    And then the solution becomes clear - a calendar table.

    _____________
    Code for TallyGenerator

Viewing 2 posts - 91 through 91 (of 91 total)

You must be logged in to reply to this topic. Login to reply