Hello, I am trying to write a user sessions query to measure the number of user sessions per hour. I wish to only consider data from working days of the week (Monday to Friday).
Point 1
When I run the following query:
SELECT HOUR(startTime) AS timeOfDay, DATETIME (startTime, "E", "1d") as dayOfWeek, COUNT(*) FROM usersession WHERE useraction.application IS 'myApp' AND dayOfWeek IN ('Mon', 'Tue', 'Wed', 'Thu', 'Fri') GROUP BY timeOfDay
I get the error message Unknown field: dayOfWeek, with the field dayOfWeek in the WHERE clause highlighted.
I tried the following as well:
SELECT HOUR(startTime) AS timeOfDay, startTime, COUNT(*) FROM usersession WHERE useraction.application IS 'dxcoe-agora - prod' AND DATETIME(startTime, "E", "1d") IN ('Mon', 'Tue', 'Wed', 'Thu', 'Fri') GROUP BY timeOfDay
And was met with a generic Query parsing error underlining the DATETIME function.
Any way to achieve what I’m trying to do?
Point 2
I was also wodnering if there was any way to display hours on the line chart where there are no suer sessions (for example, if there are no usersessions at 6pm, I’d like the line chart to still show 6pm and the value of 0).


