SQL Server Forums
Profile | Register | Active Topics | Members | Search | Forum FAQ
 
Register Now and get your question answered!
Username:
Password:
Save Password
Forgot your Password?

 All Forums
 General SQL Server Forums
 New to SQL Server Programming
 Grouping by rolling days (ex:5 days pre month
 New Topic  Reply to Topic
 Printer Friendly
Author Previous Topic Topic Next Topic  

Cat7
Starting Member

USA
2 Posts

Posted - 05/24/2012 :  11:02:45  Show Profile  Reply with Quote
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

India
48076 Posts

Posted - 05/24/2012 :  15:08:07  Show Profile  Reply with Quote
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

USA
2 Posts

Posted - 05/24/2012 :  20:40:49  Show Profile  Reply with Quote
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

India
48076 Posts

Posted - 05/25/2012 :  09:54:49  Show Profile  Reply with Quote
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
  Previous Topic Topic Next Topic  
 New Topic  Reply to Topic
 Printer Friendly
Jump To:
SQL Server Forums © 2000-2009 SQLTeam Publishing, LLC Go To Top Of Page
This page was generated in 0.06 seconds. Powered By: Snitz Forums 2000