USQL - User sessions query - Filter based on computed value

SELECT
  usersession.startTime,
  userevent.startTime ,
  usersession.userSessionId,
  usersession.stringProperties.user_loginid,
  (userevent.startTime - usersession.startTime )/60000 AS error_occurrence
FROM userevent
WHERE page = '/error_page'
AND error_occurrence > 5

The above query would not work; it shows error ‘Unknown field: error_occurrence’. Is there any other option to achieve this?

Hi,

Unfortunately, you can’t use Alias in Where clause, you can use only fields.

Thanks Khejazi, for your reply.

`AND (userevent.startTime - usersession.startTime )/60000 > 5`
Even with the fields arithmetic is not allowed. Is there any workaround for this?

It will be the same since you are using an expression which is not originally a field in the table