Percentage of Active Users to Total Users

0

Please login or register to vote for this query.

(click on this box to dismiss)

Where "active" is defined as has answered a question within the last 12 months, regardless of whether the answer was accepted or upvoted. Note that this doesn't count users whose answers have been deleted.

Stack Overflow

Q&A for professional and enthusiast programmers

-- Count all Posts that are:
--   1. Answers
--   2. Have a distinct OwnerUserId
--   3. Have a CreationDate after the date of 1 year ago today
    
SELECT 
  COUNT(DISTINCT OwnerUserId) AS 'Active Users'
FROM 
  Posts
WHERE 
  PostTypeId = 2 
--AND CreationDate > DATEADD(year, -1, GETDATE())
  AND CreationDate > '##StartTime?2019/01/12 00:00:00##'
--AND CreationDate <= DATEADD(year, 1, '##StartTime##')

-- Get total users for comparison
SELECT
  COUNT(Id) AS 'Total Users'
FROM
  Users

Enter Parameters

Options:
Switch to meta site
loading Hold tight while we fetch your results