Do not input private or sensitive data. View Qlik Privacy & Cookie Policy.
Skip to main content

Announcements
Want to see what's currently in public preview? We've pulled it all together in one place. Check it out here
cancel
Showing results for 
Search instead for 
Did you mean: 
Zara
Contributor III
Contributor III

If statement/flag on a time field

Hey guys, i have a date time field formated dd/mm/yyyy hh:mm:ss.

I'm trying to create a flag in the data load for inbetween our working hours, which is 09:00:00 to 17:30:00.

I feel i must be missing something really simple but i cannot for the life of me get it to work....  

Below is what i have tired...

If(Time("Call Start Time (CommsCall)")>'09:00:00'
and Time("Call Start Time (CommsCall)")<='17:30:00',1,0) as [Outside Working Hours], //Doesnt work

If(Time("Call Start Time (CommsCall)">'09:00:00'
and Time("Call Start Time (CommsCall)"<='17:30:00')),1,0) as [Outside Working Hours1], //Doesnt work

if(time("Call Start Time (CommsCall)")>'09,00,00',1,0) as [Greater Than 9], //Works

if(time("Call Start Time (CommsCall)")>='17,30,00',1,0) as [17:30 And Above],//Doesnt work, the flag starts at 17:00:00

Labels (1)
1 Solution

Accepted Solutions
MarcoWedel
MVP
MVP

The issue might be that Time() as a formatting function doesn't change the numerical part of a timestamp.

So one solution could be to extract the (fractional) time part from your timestamp using the frac() function:

 

If(Frac([Call Start Time (CommsCall)])>='09:00:00' and Frac([Call Start Time (CommsCall)])<='17:30:00',0,1) as [Outside Working Hours]

 

 

 

 

 

View solution in original post

1 Reply
MarcoWedel
MVP
MVP

The issue might be that Time() as a formatting function doesn't change the numerical part of a timestamp.

So one solution could be to extract the (fractional) time part from your timestamp using the frac() function:

 

If(Frac([Call Start Time (CommsCall)])>='09:00:00' and Frac([Call Start Time (CommsCall)])<='17:30:00',0,1) as [Outside Working Hours]