Do not input private or sensitive data. View Qlik Privacy & Cookie Policy.
Skip to main content

Announcements
Join us in Bucharest on Sept 18th for Qlik's AI Reality Tour! Register Now
cancel
Showing results for 
Search instead for 
Did you mean: 
Anonymous
Not applicable

Grouping date field into hours

I have a date field in qlik sense, [completed_date], that includes all times of the day as number.  I can convert these to day by using Date function, but am trying to figure out if there is a way to group this field by hour. I have used the Hour function, but that does not return the correct information, rather it groups all the days together, then groups by hour.  I tried Date(hour([completed_date])) but, similar results.  I really just want this new dimension to group each day by hour, so I can see, lets say, 9/21/2018 4:00, 9/21/2018 3:00, 9/21/2018 2:00, and so on.  Is there an expression that can be used to achieve this?  Thanks in advance for help.

2 Replies
swuehl
MVP
MVP

Use a rounding function like Round(), Floor() or Ceil():

Timestamp(Round(TIMESTAMPFIELD, Maketime(1))) as RoundedToHourTimestamp

Anonymous
Not applicable
Author

Worked, thank you!