Wednesday, July 31, 2013

Looking to create average rating over daily, weekly, monthly, MTD, quarterly, QTD, yearly, and YTD

In all the 3 queries you need to modified as below. I am calculating only for Month and Year, others you can try it yourself.


Example:



SELECT 'Company-Avg Recommendation of Service Rating-ExistingPt' AS ID,
Month(SurveyStart) as SurveyStartMonth,
Year(SurveyStart) as SurveyStartYear
ROUND(AVG(CAST(s.SurveyQ9 AS float)),2) AS DataPoint
FROM [dbo].[SurveyTb] AS s
GROUP BY Month(SurveyStart),Year(SurveyStart)





Regards, RSingh



No comments:

Post a Comment