Skip to main content
Announcements
Introducing Qlik Answers: A plug-and-play, Generative AI powered RAG solution. READ ALL ABOUT IT!
cancel
Showing results for 
Search instead for 
Did you mean: 
noman212
Creator III
Creator III

Time Tiers/ Bucket

Hi Community,

I need your help to calculate time in hours and Tier/Bucket as shown in attached image.

I have two date fields Reported_Time and Closed_Time and I need an interval in hours from that field.

Somehow, I succeeded to calculate the interval in hours by using the function.

      Interval((Timestamp(Floor(RESOLVEDATE)))- Timestamp(Floor(REPORTEDTIME)),'hh') AS RESOLVED_TIME_MINUTE



similarly, I need Tiers/Bucket like 0-1hrs, 1-8hrs and so on.


IF(Interval(Num((Floor(RESOLVEDATE)))- Num((Floor(REPORTEDTIME))),'hh') >= '00' and Interval(Num((Floor(RESOLVEDATE)))- Num((Floor(REPORTEDTIME))),'hh') <= '05', '0-5 hrs') as TIME


Please help to calculate the tiers like the attached image.

Untitled.png

1 Solution

Accepted Solutions
mtucholski
Creator
Creator

Hello,

For interval hours between dates you can use much simpler syntax:

round((REPORTEDTIME-RESOLVEDATE)*24) as hours


For as you call it "buckets" you coud use IntervalMatch:

IntervalMatch

Check the sample file with my solution.

cheers

View solution in original post

3 Replies
kfoudhaily
Partner - Creator III
Partner - Creator III

hello,

i'm not sure about what you want to do but you have a problem with your if condition

if syntax: if(condition and condition2, value if true, value if false)

in your expression you put: if(condition1 and condition2)

the if here is going to evaluate both of your conditions and just go to the next instruction and "TIME" field should be empty.

what is the output if both of your condition are correct?

what is the expected output if they are false?

regards,

QlikView Qlik Sense consultant
mtucholski
Creator
Creator

Hello,

For interval hours between dates you can use much simpler syntax:

round((REPORTEDTIME-RESOLVEDATE)*24) as hours


For as you call it "buckets" you coud use IntervalMatch:

IntervalMatch

Check the sample file with my solution.

cheers

noman212
Creator III
Creator III
Author

That's what i want.

Thanks a lot.