cancel
Showing results for 
Search instead for 
Did you mean: 

Calculating Time Interval between Two Time Feilds

D_Yadav
Discoverer
0 Kudos
169

SAP Datasphere #TimeInterval

Hi All,
I have requirement to calculate the time interval between two Time Feilds in Graphical View using Calculated Column
There are 4 Dimension for a requirement with data in below format. I need to calculate time interval between Process Order Start Time and Finish Time in Hours. I have tried various function but it's not giving accurate results. Can anyone help me to calculate the expected results.

Process Order Actual Start DateProcess Order Actual Finish DateProcess Order Actual Start Time (HHMISS)Process Order Actual Finish Time (HHMISS)Time Interval between Process Order Start Time and Finish Time in hrs (Expected Result)
20250106202501071641440000008
202501072025012206393300000018
20250117
20250117
000000
093135
9
View Entire Topic
Simon_Ye
Product and Topic Expert
Product and Topic Expert
0 Kudos

You need to concatenate The Date and Time column to generate a timestamp, then calculate the interval:

Formula of the calculate column "IntervalDays": : DAYS_BETWEEN(TO_TIMESTAMP(CONCAT(START_DATE,START_TIME),'YYYYMMDDHHMISS'),TO_TIMESTAMP(CONCAT(END_DATE,END_TIME),'YYYYMMDDHHMISS'))

Simon_Ye_0-1742451450287.png

 

D_Yadav
Discoverer
0 Kudos
Thanks for Response Simon. I need to calculate only hours between two time feilds Process Order Actual Start Time and Process Order Actual Finish Time. Date field is not involve in calculation.
Simon_Ye
Product and Topic Expert
Product and Topic Expert
0 Kudos
First, you have to involve the Date because start and end date might be different and DSP doesn't support Time type. second, you can replcae the function DAYS_BETWEEN with SECONDS_BETWEEN to get the seconds, then convert the seconds to hours you want