# Design issueWeekly & Monthly User activity stats

#### Crazy-Achmet

##### Well-known member
Hey everybody,

i'm not sure if that's a bug or if i'm missunderstanding it. In my opinion if i have 1.000 Users active each day and those 1.000 users are the same on every day in a month at the end of the month i'm having 1.000 active users.

But the statistics page says i'm having 30.000 active users.

Warm regards from Germany

Florian

#### Brogan

##### XenForo moderator
Staff member
The weekly and monthly stat's are cumulative daily totals, not averages.

#### Crazy-Achmet

##### Well-known member
Yeah, i know. On other stats like new threads, posts, conversations,... that would be right but not on active users. A community with 5.000 registered users should have stats with 30.000 active users.

#### Mike

##### XenForo developer
Staff member
The system is designed around summing to get aggregate stats. This is (I think) the only stat that doesn't work that way. You would effectively need to divide but the number of days in the period.

#### RobParker

##### Well-known member
You would effectively need to divide but the number of days in the period.
That's wrong isn't it?

A very simplified example:

Say you have 10 active users one day and 100 the next day. If the "month" was 2 days long, as it stands it'd return 110 as the value. Your advice is to half it to make it 55.

But in that month you've had at least 100 active unique users and potentially up to 110 unique users (assuming the 10 on day 1 didn't visit on day 2).

#### jeffwidman

##### Active member
I used to run an analytics software company, and this uniques vs totals stuff was a major headache. Thankfully it's only this one metric.

Often you have to do a SELECT COUNT(DISTINCT object_id)... but in this case all you really need is:
Code:
``SELECT COUNT(user_id) FROM xf_user WHERE last_activity >= [1st of the month] AND last_activity < [1st of next month]``

#### Crazy-Achmet

##### Well-known member
It's not that easy. With that query you'll get the active users of last month, but you've no data to compare cause you can't get the active users of 2 month ago

#### jeffwidman

##### Active member
Unfortunately, there's no way to retroactively get unique user logins if you're looking for a query you can run right now to get past months.
If this feature is implemented, then the results at the end of each month just need to be stored for future reference. Several other stats have the same issue, that's why the rebuild stats tool explicitly includes a warning next to "delete cached data" that once deleted, some of the past data can't be regenerated.

##### Well-known member
Say I have a site with 10,000 users. If I wanted to see how many of those users logged in last month, how would I do that?

#### RDR

##### Well-known member
Say I have a site with 10,000 users. If I wanted to see how many of those users logged in last month, how would I do that?
ACP > Users > Search for Users

Set the "Last visited between:" to 30 days ago and leave everything else default.

Click submit and you should get a list of users and in the bottom right will be your total count.