OLAP Aggregate Queries : Grouping Parameter : Group by Timestamp Subfield

Group by Timestamp Subfield
Doradus OLAP supports grouping by timestamp subfields. For example:
.../Message/_aggregate?q=*&m=COUNT(*)&f=TOP(3,SendDate.HOUR)&range=0
SendDate is a timestamp field belonging to the Message table; the subfield HOUR extracts the hour-of-day component of the timestamp, which is a value between 0 and 23. Since SendDate.HOUR is wrapped in a TOP function, the grouping parameter produces the 3 top-most hours. In other words, this aggregate query finds the 3 hours of the day in which the most messages are sent.
Grouping by a timestamp subfield is different than using the TRUNCATE function. Grouping by a subfield extracts a timestamp component, so there will never be more values than the component allows (e.g., 12 months in a year, 24 hours in a day). In comparison, TRUNCATE(SendDate,HOUR) rounds down (truncates) each SendDate value to its hour precision, but it will produce a value for every year-month-day-hour combination found among selected objects.