Percentage of closed, deleted questions per month over time

1

Please login or register to vote for this query.

(click on this box to dismiss)

Physical Fitness Meta

Q&A about the site for physical fitness professionals, athletes, trainers, and those providing health-related needs

SELECT
  DATEFROMPARTS(
    DATEPART(yyyy, CreationDate),
    DATEPART(mm, CreationDate),
    1) AS 'Month',
  /*
  COUNT(CASE
    WHEN DeletionDate IS NULL AND ClosedDate IS NULL THEN 1
    ELSE NULL
  END) AS 'OpenQ',
  COUNT(*) AS AllQuestions,
  */
  ROUND(CAST(COUNT(CASE
    WHEN DeletionDate IS NULL AND ClosedDate IS NOT NULL THEN 1
    ELSE NULL
    END) as float) / COUNT(*) * 100, 3) as ClosedNotDeleted,
    ROUND(CAST(COUNT(CASE
    WHEN DeletionDate IS NOT NULL AND ClosedDate IS NULL THEN 1
    ELSE NULL
    END) as float) / COUNT(*) * 100, 3) as DeletedNotClosed,
    ROUND(CAST(COUNT(CASE
    WHEN DeletionDate IS NOT NULL AND ClosedDate IS NOT NULL THEN 1
    ELSE NULL
    END) as float) / COUNT(*) * 100, 3) as ClosedAndDeleted,
    ROUND(CAST(COUNT(CASE
    WHEN DeletionDate IS NOT NULL OR ClosedDate IS NOT NULL THEN 1
    ELSE NULL
    END) as float) / COUNT(*) * 100, 3) as ClosedOrDeletedOrBoth
  
FROM PostsWithDeleted
WHERE PostTypeId=1
GROUP BY DATEFROMPARTS(
    DATEPART(yyyy, CreationDate),
    DATEPART(mm, CreationDate),
    1)
ORDER BY Month DESC

Enter Parameters

Options:
Switch sites:
loading Hold tight while we fetch your results