Quantcast
Channel: SCN: Message List - SAP HANA Developer Center
Viewing all articles
Browse latest Browse all 9165

Re: How to calculate Working Days between two date and time in SAP HANA Graphical Modeling?

$
0
0

Hi Ramana, 

 

One of the way to achieve this is creating a scripted calculation view with input parameters parameters as STARTDATE timestamp, ENDDATE timestamp and ( assuming we have 5 working days in a week)   , then use MIGRATE to convert it to GRAPHICAL VIEW.

the output columns will be numofworkingdays type integer.

 

 

Logic :-

 

1. Find number of weeks using   (DAYS_BETWEEN(:STARTDATE,:ENDDATE))/7

2. Find start-week and end-week using WEEK function .

3. if number of week is <=2, use WEEKDAY function to get the day of the week from STARTDATE      and similarly get day of week from :ENDDATE.

For e.g if startdate is day 4 (Friday) then on 1 working day   from week 1 . ENDDATE is day 5 (saturday) of second week   , numofworkingdays = 1 + 4 = 5

elseif number of weeks is > 2 its 1+ 4 + 5 = 9.


Keep adding 5 working days depending on number of weeks between start week and end week.



Hope this helps.




Viewing all articles
Browse latest Browse all 9165

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>