Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 General SQL Server Forums
 New to SQL Server Programming
 Grouping by rolling days (ex:5 days pre month

Author  Topic 

Cat7
Starting Member

2 Posts

Posted - 2012-05-24 : 11:02:45
Can someone help? I am creating a chart in ssrs that shows number of new subscriber for every 5 days. I need to figure out how to group those subscriber with rolling 5 day. I do not need help with chart just the best way to get the grouping. I have the parameters set with start and end dates. Thanks!

visakh16
Very Important crosS Applying yaK Herder

52326 Posts

Posted - 2012-05-24 : 15:08:07
does rolling period has to be based on input parameter values?

------------------------------------------------------------------------------------------------------
SQL Server MVP
http://visakhm.blogspot.com/

Go to Top of Page

Cat7
Starting Member

2 Posts

Posted - 2012-05-24 : 20:40:49
quote:
Originally posted by visakh16

does rolling period has to be based on input parameter values?

------------------------------------------------------------------------------------------------------
SQL Server MVP
http://visakhm.blogspot.com/




yes, it does
Go to Top of Page

visakh16
Very Important crosS Applying yaK Herder

52326 Posts

Posted - 2012-05-25 : 09:54:49
something like

SELECT DATEDIFF(dd,Datefield,@EndDate)/5,COUNT(SubscriberID) AS Cnt
FROM Table
WHERE Datefield >=@StartDate
AND DateField < @EndDate + 1
GROUP BY DATEDIFF(dd,Datefield,@EndDate)/5


------------------------------------------------------------------------------------------------------
SQL Server MVP
http://visakhm.blogspot.com/

Go to Top of Page
   

- Advertisement -