Qlik Community

QlikView Creating Analytics

Discussion Board for collaboration related to Creating Analytics for QlikView.

Not applicable

Help with IF statement

Hi,

I need a bit of help with creating an IF Statement.  I have a calculated expression which is below, which works out the hours between the time my call was closed to when it was logged. 

=Interval(

          (RangeMin(frac(closedate_true), MakeTime(18))
   - RangeMax(frac(logdate_true), MakeTime(8)))
   + (NetWorkDays(logdate_true, closedate_true-1) * MakeTime(10)) // Only 10 hours per whole day

)

One of the things the below script does, it doesnt calculate any time between before 08:00 and after 18:00.  However I have noticed that if a call is logged and closed before the calulcation sets in, it then sets the sum as a minus figure.

I have been advised to create and IF Statement to ignore any calculation where the call was not logged and closed between 08:00 - 18:00, however I have no idea how to start my IF Statement.

Would someone be able to assist me with this please?

Regards,

Jon Ditchfield

1 Reply
MVP
MVP

Re: Help with IF statement

Hi Jon,

I assume you want to discard those records with values i.e.: 23:00 or 06:58 (before 8 and after 20). If so:

=If(Frac(closedate_true) > MakeTime(18) OR Frac(logdate_true) < MakeTime(8),

Interval(

     (RangeMin(frac(closedate_true), MakeTime(18))

     - RangeMax(frac(logdate_true), MakeTime(8)))

     + (NetWorkDays(logdate_true, closedate_true-1) * MakeTime(10)) // Only 10 hours per whole day

)

, 'Discarded'

)

Hope that helps.

Miguel

Community Browser