Forum Discussion

jhenscheid's avatar
jhenscheid
Frequent Visitor
9 years ago
Solved

Setting Friday as End of Week

Hello, I have a data set that has a list of trip with a Drop Due Date.  This drop due date can be any day of the week, but I want to do a count of have the cutoff to be Friday of each week.

 

I am using the calculation;

 

Delivery Week = (Transfers[Drop Due Date] + 6 - WEEKDAY(Transfers[Drop Due Date],1))

 

This seemed to be working at first, but I noticed that any trip with a drop due date of 8/19/2017 (a Saturday) reverts back to the previous Friday (8/18/2017).  I need to have these trips be a part of w/e 8/25/2017.

 

In other words, I need to have any load with a Drop Due Date of Saturday to Friday be included in the Friday at the end of this 'week'.

 

Here is a snapshot of some of my data.

ModeLoadIDCreateDrop Due DateDelivery Week
TL692202198/16/2017 16:298/20/2017 9:328/25/2017 9:32
TL692353538/17/2017 8:418/20/2017 8:588/25/2017 8:58
TL692861428/18/2017 9:208/20/2017 8:588/25/2017 8:58
TL692789848/18/2017 7:278/20/2017 8:448/25/2017 8:44
TL691969178/16/2017 10:248/20/2017 8:148/25/2017 8:14
TL691919578/16/2017 9:168/20/2017 8:008/25/2017 8:00
TL691845028/16/2017 7:208/20/2017 7:558/25/2017 7:55
TL691219478/14/2017 13:508/20/2017 7:128/25/2017 7:12
TL691788858/16/2017 1:088/20/2017 7:048/25/2017 7:04
TL692232838/16/2017 19:318/20/2017 5:428/25/2017 5:42
TL691793498/16/2017 2:498/20/2017 3:008/25/2017 3:00
TL691886008/16/2017 8:278/20/2017 2:158/25/2017 2:15
TL691582948/15/2017 11:398/19/2017 23:598/18/2017 23:59
TL692719288/18/2017 0:078/19/2017 23:598/18/2017 23:59
TL692731108/18/2017 1:358/19/2017 23:598/18/2017 23:59
TL692731148/18/2017 1:398/19/2017 23:598/18/2017 23:59
TL692732138/18/2017 2:158/19/2017 23:598/18/2017 23:59
TL692732868/18/2017 2:348/19/2017 23:598/18/2017 23:59
TL692736238/18/2017 3:418/19/2017 23:598/18/2017 23:59
TL692739278/18/2017 4:058/19/2017 23:598/18/2017 23:59

 

 

  • Try:  

    (Transfers[Drop Due Date] + IF(WEEKDAY(Transfers[Drop Due Date],1) = 7, 6, 6 - WEEKDAY(Transfers[Drop Due Date],1)))

    This looks at the day of week and determines, if Saturday then add 6 days otherwise use logic that is already in place. 

     

     

     

2 Replies

  • Try:  

    (Transfers[Drop Due Date] + IF(WEEKDAY(Transfers[Drop Due Date],1) = 7, 6, 6 - WEEKDAY(Transfers[Drop Due Date],1)))

    This looks at the day of week and determines, if Saturday then add 6 days otherwise use logic that is already in place. 

     

     

     

    • jhenscheid's avatar
      jhenscheid
      Frequent Visitor

      Thank you for the quick solution!  This worked perfectly!

       

      Jeff