Quantcast
Channel: SQLServerCentral » Reporting Services » Reporting Services » Latest topics
Viewing all articles
Browse latest Browse all 2791

Receiving Correct Output

$
0
0
Hey guys, so I have this stored procedure. The query works fine but the problem is the output. I wanted the user to enter a BEGIN DATE and END DATE. And the output be only those months between the user has chosen. I don't want other Columns of the months to be shown which is the problem I am having.I am using a table in Report builder 3.0 and can't use matrix. [u]This is my Stored procedure:[/u][code="sql"]Alter Proc spGetAdminTotalYTDDD(@Begin_Date DATETIME, @End_Date DATETIME, @program int=null) As Declare @year int Set @year = 2014Begin SELECT d.name, a.dealer_code, b.last_name, b.city, b.state, b.phone , month(c.Funded_date) [Month] , datename(month, dateadd(month, month(c.funded_date), - 1)) [MonthName], count(1) As YTD FROM tdealer a JOIN tContact b ON a.contact_id = b.contact_id JOIN tContract c ON a.dealer_id = c.dealer_id JOIN tCompany d ON c.company_id = d.company_idWHERE d.company_id = @program AND c.Funded_date >= DATEADD(MONTH, DATEDIFF(MONTH, 0, GETDATE())-5, 0) And YEAR(c.Funded_date) = @Year And c.Funded_date < DATEADD(MONTH, DATEDIFF(MONTH, -1, GETDATE())-1, 0) And (c.funded_date) between @Begin_Date And @End_Date GROUP BY d.name, a.dealer_code, b.last_name, b.city, b.state, b.phone, Month(c.funded_date)end[/code]

Viewing all articles
Browse latest Browse all 2791

Trending Articles