I've built a SQL report in MS SQL Server Report builder for our ticketing backend. I want to be able to do custom reporting. I've created this report by using the following query:

SELECT
  SR_Service.Date_Closed
  ,SR_Service.Date_Entered
  ,SR_Service_SLA_Workflow.Responded_Minutes
  ,AVG(SR_Service_SLA_Workflow.Resolved_Minutes) AS Avg_Resolved_Minutes
  ,SR_Service.Hours_Budget
  ,SR_Service_SLA_Workflow.SR_Service_RecID AS [SR_Service_SLA_Workflow SR_Service_RecID]
  ,SR_Service.SR_Service_RecID AS [SR_Service SR_Service_RecID]
  ,SR_Service.Company_RecID AS [SR_Service Company_RecID]
  ,Company.Company_RecID AS [Company Company_RecID]
  ,Company.Company_ID
FROM
  Company
  INNER JOIN SR_Service
    ON Company.Company_RecID = SR_Service.Company_RecID
  INNER JOIN SR_Service_SLA_Workflow
    ON SR_Service.SR_Service_RecID = SR_Service_SLA_Workflow.SR_Service_RecID
GROUP BY
  SR_Service.Date_Closed
  ,SR_Service.Date_Entered
  ,SR_Service_SLA_Workflow.Responded_Minutes
  ,SR_Service.Hours_Budget
  ,SR_Service_SLA_Workflow.SR_Service_RecID
  ,SR_Service.SR_Service_RecID
  ,SR_Service.Company_RecID
  ,Company.Company_RecID
  ,Company.Company_ID

With a few filters set on company must not equal (some inactive companies i dont care about)

Obviously, you cannot tell this is a correct query because you don't see my database. However... it works. the report builds and I have a 2 line table, one with Customer names and the second is average time it takes to close our tickets by hours (taken minutes/60)

What I need: The ability to, when I run this report, have it ask for a date range. This can be either a few options (last week, last month, running thirty dates) OR just a place where they select a date range.

Recommended Answers

All 2 Replies

Member Avatar for LastMitch

What I need: The ability to, when I run this report, have it ask for a date range. This can be either a few options (last week, last month, running thirty dates) OR just a place where they select a date range.

You can read this (it will show you how to group the dates):

http://msdn.microsoft.com/en-us/library/dd220417.aspx

Create a store procedure that the report calls. Have the start_date and End_date as variables.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.