06 Jun 2024
03:36 PM
- last edited on
07 Jun 2024
07:54 AM
by
MaciejNeumann
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
Solved! Go to Solution.
07 Aug 2024 12:56 PM
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!