The query that Spotlight run can be reduced to the following:
select count(distinct case when s.host_name is not null
and s.program_name not like N'SQLAgent - %' --
ignore SQLAgent system processes
then s.session_id
else null end)
as [User Connection Count]
from sys.dm_exec_sessions s with (readpast)