19 Nov 2020
	
		
		02:40 AM
	
	
	
	
	
	
	
	
	
	
	
	
	
	
 - last edited on 
    
	
		
		
		26 Apr 2021
	
		
		12:58 PM
	
	
	
	
	
	
	
	
	
	
	
	
	
	
 by 
				
		 MaciejNeumann
		
			MaciejNeumann
		
		
		
		
		
		
		
		
	
			
		
Hi,
I am trying to gather user count & user session count using usql,but the metrics it was giving is not matching.
Can someone help me with the proper query to get these metrics.
Thanks,
Solved! Go to Solution.
19 Nov 2020 12:29 PM
For the user session count you can use:
SELECT Count(*) FROM usersession
For user count use the following for tagged users:
SELECT Count(DISTINCT(userid)) FROM usersession
or this one if you want all users, including anonymous users:
SELECT Count(DISTINCT(internalUserId)) FROM usersession
