Skip to main content
Announcements
Join us at Qlik Connect for 3 magical days of learning, networking,and inspiration! REGISTER TODAY and save!
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

Date Time Diff / If statement

Hi Please can you help:

I am trying to create a formula that will calculate the date/ time diiference between two times and depending on this number in minutes, I want it to display whether it is a late start by how many minutes, early start by how many minutes or started on time.

= (if (interval( session_actual_start - scheduled_start, 'mm') >-10, 'Started  ' &  interval (session_actual_start-scheduled_start, 'mm') & '  mins early',

if(session_start_difference >=-10 and session_start_difference <=10, 'Started On Time',

if (interval(session_actual_start - scheduled_start, 'mm') >10, 'Started  ' &  interval (session_actual_start-scheduled_finish, 'mm') & '   mins late'))))

This is the formula, which is working for Early starts but not picking up late starts, it still showing early start even though it is late.

Also, when it shows an early start it says: Started -50 mins early, how do I get rid of the - infont of the number?

Hope this makes sense and someone can help!

Thanks,

1 Reply
Gysbert_Wassenaar

You can use the fabs() function so that negative numbers are made positive:

if (interval( session_actual_start - scheduled_start, 'mm') <-10, 'Started  ' &  interval (fabs(session_actual_start-scheduled_start), 'mm') & '  mins early',...etc


talk is cheap, supply exceeds demand