Skip to main content
Announcements
Qlik Connect 2024! Seize endless possibilities! LEARN MORE
cancel
Showing results for 
Search instead for 
Did you mean: 
hopkinsc
Partner - Specialist III
Partner - Specialist III

What is wrong with this expression?

Hi all, i have attached a sample file where i am getting an issue with an expression.

The expression should be summing the OrderComplete_Flag where the [Time Taken to Complete] is less than 4hrs.

the result i get should be 3 but i am getting 6 and i am unsure on why.

the expression is saying that 3 of the times are less than 4 hrs but they are not.

Can anyone help please?

1 Solution

Accepted Solutions
Not applicable

=sum(if(SubField([Time Taken to Complete],':',1)<4,1,0))

View solution in original post

5 Replies
Not applicable

=sum(if(Interval([Time Taken to Complete],'hhh')>=4,1,0))

hopkinsc
Partner - Specialist III
Partner - Specialist III
Author

Hi, Sorry, i have just noticed that your expression says greater or equal to 4. i need it less than 4 but when i do that i get the wrong result.

Not applicable

=sum(if(SubField([Time Taken to Complete],':',1)<4,1,0))

hopkinsc
Partner - Specialist III
Partner - Specialist III
Author

thats great thanks very much..

One more question,

how would i get a time range in there?

eg

it is currently set at <4 hrs, but what if i wanted >1hr <24hrs?

Not applicable

=sum(if(SubField([Time Taken to Complete],':',1)>1 AND SubField([Time Taken to Complete],':',1)<24,1,0))