# New to Qlik Sense

If you’re new to Qlik Sense, start with this Discussion Board and get up-to-speed quickly.

Announcements
cancel
Showing results for
Did you mean:
Contributor III

## Times in buckets

Hi Guys

could you please assist where i am going wrong with my formula:

i want to calculate the the average time between 04:00 and 06:00 (bucket)

aggr(avg(if(StartTime>'04:00' and StartTime<'06:00')),StartTime)

Kind Regards

2 Solutions

Accepted Solutions
MVP

Oh may be you have date in your time field... try this

``Avg(If(Frac(StartTime) > MakeTime(4) and frac(StartTime) < MakeTime(6), StartTime))``
MVP

Try this

``Time(Avg(If(Frac(StartTime) > MakeTime(4) and frac(StartTime) < MakeTime(6), Frac(StartTime))))``
9 Replies
MVP

May be you need this?

``Avg(If(StartTime > MakeTime(4) and StartTime < MakeTime(6), StartTime))``
Contributor III
Author

Avg(If(StartTime > 4 and StartTime < 6, StartTime))

not working, my Startime field info consists of HH:MM:SS

hope this helps

MVP

Did you try this?

``Avg(If(StartTime > MakeTime(4) and StartTime < MakeTime(6), StartTime))``
Contributor III
Author

Yes, not working

Below is my "startTime" field calculation

MVP

Oh may be you have date in your time field... try this

``Avg(If(Frac(StartTime) > MakeTime(4) and frac(StartTime) < MakeTime(6), StartTime))``
Contributor III
Author

@sunny_talwar Excellent!, Thank you so much!

Contributor III
Author

I have used to above formula, but the avg. time doesn't seem to take the time between the two band 04:00-06:00

Formula used: Time(Avg(If(Frac(StartTime) > MakeTime(4) and frac(StartTime) < MakeTime(6), StartTime)))

MVP

Try this

``Time(Avg(If(Frac(StartTime) > MakeTime(4) and frac(StartTime) < MakeTime(6), Frac(StartTime))))``
Contributor III
Author

@sunny_talwar Thanks!

Tags