Skip to main content
Announcements
Accelerate Your Success: Fuel your data and AI journey with the right services, delivered by our experts. Learn More
cancel
Showing results for 
Search instead for 
Did you mean: 
jayati_shrivast
Contributor III
Contributor III

previous function use in date field

Hi All,

I have a date field as 'DD-MM-YYYY, hh:mm:ss'.

I need to add another column as total status duration which is nothing but total available time for a particular date.

for this I applied the function in the script as:

if(USER_NAME) = previous(USER_NAME)  and DATE = previous(DATE) and STATUS <> previous(STATUS), interval(date(DATE,'hh:mm:ss'))  - previous(date(DATE,'hh:mm:ss'))), as TOTAL STATUS DURATION.

But I am getting NO values under the column TOTAL STATUS DURATION

I have a straight  table as follows:

USER_NAME         DATE                                         STATUS        AVAILABLE     OFFLINE     TOTAL STATUS DURATION

A                               11-JAN-2019  11:35:00         available       11:35:00               -

A                               11 JAN- 2019   11:40:00        offline              -                    11:40:00

B                               12 JAN-2019      12:30:00      available      12:30:00             -

B                               12 JAN-2019      12:40:00       offline              -                     12:40:00      

 

I should get the table layout as follows:

 

USER_NAME         DATE                                         STATUS        AVAILABLE     OFFLINE     TOTAL STATUS DURATION

A                               11-JAN-2019  11:35:00         available       11:35:00               -                  00:05:00

A                               11 JAN- 2019   11:40:00        offline              -                    11:40:00              -  

B                               12 JAN-2019      12:30:00      available      12:30:00             -                      00:10:00

B                               12 JAN-2019      12:40:00       offline              -                     12:40:00      

 

How can I implement this?

pls help me.

 

Thanks

 

1 Reply
shiveshsingh
Master
Master

As  per your Date format, this expression will  be evaluated as failed...DATE = previous(DATE)

You need to make one more column which will be showing only date not time.