Percentage of questions in given tags per month

1

Please login or register to vote for this query.

(click on this box to dismiss)

Mathematics

Q&A for people studying math at any level and professionals in related fields

;with pcnt as
(
select eomonth(p.creationdate) [date]
     , count(p.id) as [count]
from posts p
where p.PostTypeId=1
group by eomonth(p.creationdate)
)
, tagsel as 
(
select distinct creationdate, p.id
from posts p
inner join posttags pt on pt.postid = p.id
inner join tags t on t.id = pt.tagid
inner join string_split(##tags:string?statistics,probability##,',')
         on value = t.tagname
where p.creationdate between ##date1:string?2016-01-01##
                         and ##date2:string?2018-09-01##
)
, tagstats as
(
  select eomonth(creationdate) [date]
       , count(id) [tagcount]
  from tagsel
  group by eomonth(creationdate)  
)

select pcnt.[date]
     , convert(decimal, tagcount) * 100 / [count] [perc]
from tagstats
inner join pcnt on pcnt.[date] = tagstats.[date]
order by pcnt.[date]

Enter Parameters

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