cancel
Showing results for 
Search instead for 
Did you mean: 
Read only

Given a date, how to find the nearest Monday using SAC Data Action

SP9
Explorer
0 Likes
876

Hi Experts,

Given a date in integer format, how to find the nearest Monday of it in SAP SAC data action. 

We have a date in interger format in a measure called: "Shipment Date", that will be entered by the planner, and we need to find the nearest Monday after 10 days, that's the max "Delivery by Date".

So, for example, Shipment date is: 05/27/2024,  the delivery date should be calculated as: 06/03/2024, instead of 06/10/2024, as this is the nearest Monday to date: 06/06/2024, when added 10 days to 05/27/2024. 

Thanks,

SP

Accepted Solutions (0)

Answers (2)

Answers (2)

ThomasK
Active Participant
0 Likes

Hi @SP9 , I´m afraid this can´t be solved with a data action. If it´s an option for you, it´s more likely you can solve it with scripting in a story. -- Thomas

SP9
Explorer
0 Likes
Hi Thomas, Thanks. Can you please give the solution on solving this with scripting in a story?
ThomasK
Active Participant
0 Likes
Sorry, I don´t have a code available for this. If you are familiar with JavaScript you should be able to manage it.
MKreitlein
Active Contributor
0 Likes

Hello @SP9 

I doubt that you will find a good solution for that in SAC.

But you could maybe testing if you can utilize the Date's Day name colunm:

SAC_Date_dayname.png

I'm not sure if you can access this... but even if it might become a complex logic?!
Good luck,

Martin

SP9
Explorer
0 Likes
Thanks Martin. Good idea but complex. Thanks