Skip to main content
Announcements
Qlik Introduces a New Era of Visualization! READ ALL ABOUT IT
cancel
Showing results for 
Search instead for 
Did you mean: 
rustyfishbones
Master II
Master II

How to create Time Buckets with DateTime

Hi All,

I have the following field StartDateTime and I want to create hourly time buckets like the image on the left.

2014-02-24_0937.png2014-02-24_0937_001.png

I have tried the following

2014-02-24_0940.png

however, it's giving me hourly buckets, but for each day, so instead of getting the 24 hourly buckets I am getting 24 for each day.

I also tried using SUBFIELD Function to extract the time stamp, but I keep getting a result of 00:00

Any help would be appreciated

1 Solution

Accepted Solutions
hic
Former Employee
Former Employee

Then you need to cut away the integer part of the timestamp:

     Time(Class(Frac(StartDateTime), 1/24), 'hh:mm')


HIC

View solution in original post

6 Replies
rustyfishbones
Master II
Master II
Author

sorry like image on the right!!!

jonathandienst
Partner - Champion III
Partner - Champion III

Hi

This should do the trick:

Time(Class(StartDateTime, 1/24), 'hh:mm')

HTH

Jonathan

Edit: forgot to put the frac() inside the class!!

Logic will get you from a to b. Imagination will take you everywhere. - A Einstein
rustyfishbones
Master II
Master II
Author

Hi Jonathon,

That gives me the time buckets, but again I am getting them for each day

if you notice the size of scroll bar on the image below, I have lots of hourly buckets instead of just 24

2014-02-24_0953.png

nagaiank
Specialist III
Specialist III

Try

Interval(Floor(Frac(StartDateTime)*24) / 24,'hh:mm')

hic
Former Employee
Former Employee

Then you need to cut away the integer part of the timestamp:

     Time(Class(Frac(StartDateTime), 1/24), 'hh:mm')


HIC

rustyfishbones
Master II
Master II
Author

Hi All,

The following worked for me

2014-02-24_1011.png

however I like the solution Henric provided best