I load some million events from a psql database. The events occures over the day at any time and the entity contains a datetime-field. I want to count the events occuring at different times and days of a week, aggregated over some years.
Therefore i want to divide the 10080 minutes of a week in a numberd sequence of 10080/n slots, numbered from 1 to 10080/n. Example: MinutesOfTimeslot=15, timeslot nr.1 goes from 00:00:00 to 00:14:59 on monday an the last nr.672 from 23:45:00 to 23:59:59 on sunday.
I think to do the calculation during the load-process like this:
ODBC CONNECT TO PostgreSQL64;
slot(enventTime,MinutesOfTimeslot) as slot_nr;
SQL SELECT *
I am not very experienced in SQL or QLIKVIEW and don't know if there are any existing functions fullfilling my wishes. Later it could be interesting to consider vacation and public holidays to compare similar days or weeks over the years.
I am working with a free desktop version. Therefor i cannot read your example.
So i first tried to understand the code. After that i implemented, based on your example a solution. This works, but i saw some results i don't really understand in the moment, and i have to look for. It seems, there are some problems with the format of my event-timestamp and the functions ceil and floor returns values i cannot comprehend.
Furthermore i recognized, that my solution works, but is very slow.