Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

Earn a 50% discount on the DP-600 certification exam by completing the Fabric 30 Days to Learn It challenge.

Reply
jhenscheid
Frequent Visitor

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

 

 

1 ACCEPTED SOLUTION
JayHerrera
Advocate I
Advocate I

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. 

 

2017-08-25_14-35-48.png

 

 

View solution in original post

2 REPLIES 2
JayHerrera
Advocate I
Advocate I

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. 

 

2017-08-25_14-35-48.png

 

 

Thank you for the quick solution!  This worked perfectly!

 

Jeff

Helpful resources

Announcements
LearnSurvey

Fabric certifications survey

Certification feedback opportunity for the community.

PBI_APRIL_CAROUSEL1

Power BI Monthly Update - April 2024

Check out the April 2024 Power BI update to learn about new features.

April Fabric Community Update

Fabric Community Update - April 2024

Find out what's new and trending in the Fabric Community.