Skip to main content
Announcements
Qlik Connect 2025: 3 days of full immersion in data, analytics, and AI. May 13-15 | Orlando, FL: Learn More
cancel
Showing results for 
Search instead for 
Did you mean: 
danielnevitt
Creator
Creator

Time Buckets

Hi,

I'm trying to create a time bucket field to show a count of trades by hour on a bar graph.

time(ceil(udf_utc_cd, 1/24, 1/24)) as TimeBucket

I created the above field, however when I load my data it seems to somehow remember the date from the field and therefore shows the time multiple times across different days. The attached example is for trades on 06/06/2022 - 08/06/2022. I was hoping to show all trades at 8, 9, 10 etc rather than at 8,9,10 on each day.

The field udf_utc_cd is in format dd/mm/yyyy hh:mm:ss

Thanks for your help.

Daniel

 

Labels (1)
  • Other

1 Reply
marcus_sommer

You need to separate the floating-part, for example with:

time(ceil(frac(udf_utc_cd), 1/24, 1/24)) as TimeBucket

or maybe even easier:

hour(udf_utc_cd) as Hour

- Marcus