cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

USQL for getting numbers of users by country

soportetr
Organizer

Hi everyone,

I have been trying a query to get the amount of users connected per month and also get the users connected per country but the numbers do not match.

What would be the most optimal USQL for those queries?

Thanks in advance

1 REPLY 1

GosiaMurawska
Community Team
Community Team

Hi @soportetr,

Let me quote the answer of one of our specialists:


userId - for tagged users
internalUserId - for anonymous users
COUNT - general amount of values
COUNT(DISTINCT) - amount of unique values. And its result can be approzimate and fuzzy. It is in our USQL documentation link.


If extrapolation took place - the results will be very approximate and will be big chance that they will not match.

1. Per country:
SELECT country, COUNT(DISTINCT userId) FROM usersession GROUP BY country

2. Per month:
SELECT MONTH(startTime), COUNT(DISTINCT userId) FROM usersession GROUP BY MONTH(startTime)

 

Let us know if it helps!

Featured Posts