Try this query:
Code:
SELECT COUNT(*) AS logins, FROM_UNIXTIME( last_activity, '%Y-%m') AS monthly
FROM xf_user
GROUP BY monthly
ORDER BY monthly;
That should give the count of users who logged in to your forum each month.
If you are using a different prefix for your db tables other than xf_, replace it at the query above.