Get the percentage of closed questions for each tag, excluding duplicates. You can set the minimum tag popularity with a parameter.
Q&A for people studying math at any level and professionals in related fields
-- Questions count as closed even after they are reopened.
-- (The query just checks ClosedDate.)
-- Questions that are closed more than once inflate the closed count.
-- [james-bond] on scifi.SE shows up as 150% closed because of this.
-- MinTotal: Min question count
DECLARE @min_total INT = ##MinTotal:INT?1##;
-- MaxTotal: Max question count "0 to disable"
DECLARE @max_total INT = ##MaxTotal:INT?10##;
Count(TagName) as Closed,
t.Count as Total,
ROUND(100.*Count(TagName)/t.Count,3) as [% Closed]
FROM Posts p
INNER JOIN PostTags pt ON p.Id = pt.PostId
INNER JOIN Tags t ON pt.TagId = t.Id
INNER JOIN PostHistory h ON p.Id = h.PostId
p.PostTypeId = 1 -- match questions
AND p.ClosedDate IS NOT NULL -- that have been closed at some point
AND h.PostHistoryTypeId = 10 -- and have a history entry
AND h.Comment NOT IN ('1', '101') -- that doesn't say it's a duplicate
GROUP BY TagName, t.Count
WHERE a.Total >= @min_total
AND (a.Total <= @max_total OR @max_total < 1)
[% Closed] desc, TagName